glob icon indicating copy to clipboard operation
glob copied to clipboard

Unexpected result with `PrefixSuffix.Match`

Open Chrstm opened this issue 4 years ago • 2 comments
trafficstars

The PrefixSuffix.Match doesn't consider the condition that the prefix overlaps with the suffix. version: v0.2.3 POC:

func main() {
	g, _ := glob.Compile("a*ant")
	fmt.Println(g.Match("an ant")) // true EXPECTED
	fmt.Println(g.Match("ant"))    // true UNEXPECTED

	g, _ = glob.Compile("br*r")
	fmt.Println(g.Match("brother")) // true EXPECTED
	fmt.Println(g.Match("br"))      // true UNEXPECTED

	g, _ = glob.Compile("so*so")
	fmt.Println(g.Match("so so")) // true EXPECTED
	fmt.Println(g.Match("so"))    // true UNEXPECTED
}

Chrstm avatar Jun 30 '21 02:06 Chrstm

Hey @Chrstm can you check it against the v0.3 branch?

gobwas avatar Jul 11 '21 11:07 gobwas

I checked. The result of feature/v0.3 is the same as v0.2.3. It still compile the pattern as a PrefixSuffix matcher.

Chrstm avatar Jul 14 '21 09:07 Chrstm