|
|
@ -32,12 +32,12 @@ func ExampleReg_FindAll() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func ExampleReg_FindString() {
|
|
|
|
func ExampleReg_FindString() {
|
|
|
|
regexStr := `\d+`
|
|
|
|
regexStr := `\w+\s+(?=sheep)`
|
|
|
|
regexComp := regex.MustCompile(regexStr)
|
|
|
|
regexComp := regex.MustCompile(regexStr)
|
|
|
|
|
|
|
|
|
|
|
|
matchStr := regexComp.FindString("The year is 2025")
|
|
|
|
matchStr := regexComp.FindString("pink cows and yellow sheep")
|
|
|
|
fmt.Println(matchStr)
|
|
|
|
fmt.Println(matchStr)
|
|
|
|
// Output: 2025
|
|
|
|
// Output: yellow
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func ExampleReg_FindSubmatch() {
|
|
|
|
func ExampleReg_FindSubmatch() {
|
|
|
|