Wrote example for Longest()
This commit is contained in:
@@ -78,3 +78,14 @@ func ExampleReg_LiteralPrefix() {
|
||||
// Output: a
|
||||
// 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