-
Notifications
You must be signed in to change notification settings - Fork 10
/
doc.go
33 lines (22 loc) · 1.04 KB
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
This is a Go implementation of VerbalExpressions for other languages.
Check http://VerbalExpressions.github.io to know the other implementations.
VerbalExperssions is a way to build complex regular expressions with a verbal language.
The repo name is "GoVerbalExpressions" but the real package name is "verbalexpressions". So, to import verbalexpressions package, just do:
import "github.com/VerbalExpressions/GoVerbalExpressions"
Then, use "verbalexpressions" as prefix. There is a simple example
Use "New()" factory then you can chain calls. Go syntax allows you to set new line after seperators:
v := verbalexpressions.New().
StartOfLine().
Find("foo").
Word().
Anything().
EndOfLine()
Then, you can use "Test()" method to check if your string matches expression.
You may get the regexp.Regexp structure using "Regex()" method, then use common methods to split, replace, find submatches and so on... as usual
There are some helpers that use direct call to the regexp package:
- Replace
- Captures
- Test
*/
package verbalexpressions