Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected result with PrefixSuffix.Match #51

Open
Chrstm opened this issue Jun 30, 2021 · 2 comments
Open

Unexpected result with PrefixSuffix.Match #51

Chrstm opened this issue Jun 30, 2021 · 2 comments

Comments

@Chrstm
Copy link

Chrstm commented Jun 30, 2021

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
}
@gobwas
Copy link
Owner

gobwas commented Jul 11, 2021

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

@Chrstm
Copy link
Author

Chrstm commented Jul 14, 2021

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

walkerxiong added a commit to walkerxiong/glob that referenced this issue Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants