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 matching windows paths #35

Open
nirekin opened this issue Jun 7, 2019 · 2 comments
Open

Unexpected result matching windows paths #35

nirekin opened this issue Jun 7, 2019 · 2 comments

Comments

@nirekin
Copy link

nirekin commented Jun 7, 2019

I am trying to match a windows path but the given result is not the expected one:

g := glob.MustCompile("C:\\p1\\p2\\templateTarget[12].yaml")
g.Match("C:\\p1\\p2\\templateTarget1.yaml") // false

I find a workaround replacing all the \\ by / but it's kind of annoying...

g := glob.MustCompile("C:/p1/p2/templateTarget[12].yaml")
g.Match("C:/p1/p2/templateTarget1.yaml") // true
@gobwas
Copy link
Owner

gobwas commented Jun 7, 2019

Hi @nirekin, there is a QuoteMeta() call for such cases. Ping me if it does not help :)

@nirekin
Copy link
Author

nirekin commented Jun 7, 2019

Hi @gobwas,

I have tried to use it but I cant figure how it could be helpful in that case.
Quoting the glob pattern meta characters has no effects, not good nor bad...

g := glob.MustCompile(glob.QuoteMeta("C:\\p1\\p2\\templateTarget[12].yaml"))
g.Match("C:\\p1\\p2\\templateTarget1.yaml") // false

Do you have any additional hint or example?

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