Skip to content

Commit 5bc1d99

Browse files
Merge pull request #32 from SimpleStateMachine/personal/rsolovev/update_readme
ref(Readme): Add example to readme
2 parents 2532ec4 + e5bae0b commit 5bc1d99

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,39 @@ StructuralSearch - An easy-to-use library for structural search and replace in t
77
## Give a Star! :star:
88
If you like or are using this project please give it a star. Thanks!
99

10+
# Why SimpleStateMachine?
11+
**Forget** about regular expressions and **enjoy searching**
12+
13+
1. Describe search pattern:
14+
```C#
15+
// Just text and placeholders
16+
var template = StructuralSearch.ParseFindTemplate("void $methodName$($params$)")
17+
```
18+
2. Find it in any text:
19+
```C#
20+
// All the matches are already here
21+
var results = template.ParseString("void MyMethodName(int value1, double value2)"
22+
```
23+
3. Enjoy the search results
24+
```C#
25+
// The found text part
26+
parseResult.Match.Value // void MyMethodName(int value1, double value2)
27+
28+
// The exact coordinates of the match
29+
parseResult.Match.Columnt // Start 1, End 45
30+
parseResult.Match.Line // Start 1, End 1
31+
parseResult.Match.Offset // Start 0, End 44
32+
33+
// Placeholders
34+
parseResult.Placeholders // { "methodName" : "MyMethodName" }, { "params": "int value1, double value2" }
35+
36+
// The exact coordinates of each placeceholdder
37+
parseResult.Placeholders[0].Column // Start 6, End 18
38+
parseResult.Placeholders[0].Line // Start 1, End 1
39+
parseResult.Placeholders[0].Offset // Start 5, End 17
40+
41+
```
42+
1043
## Getting Started📂
1144
Install from Nuget:
1245
```sh

0 commit comments

Comments
 (0)