Implement PCRE Matching (prefer left-branch) #2
@@ -78,3 +78,14 @@ func ExampleReg_LiteralPrefix() {
|
|||||||
// Output: a
|
// Output: a
|
||||||
// false
|
// false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExampleReg_Longest() {
|
||||||
|
regexStr := `x|xx`
|
||||||
|
inputStr := "xx"
|
||||||
|
regexComp := regex.MustCompile(regexStr)
|
||||||
|
fmt.Println(regexComp.FindString(inputStr))
|
||||||
|
regexComp.Longest()
|
||||||
|
fmt.Println(regexComp.FindString(inputStr))
|
||||||
|
// Output: x
|
||||||
|
// xx
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user