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

Add MatchBytes() #32

Open
willbuckner opened this issue Oct 6, 2018 · 0 comments
Open

Add MatchBytes() #32

willbuckner opened this issue Oct 6, 2018 · 0 comments

Comments

@willbuckner
Copy link

willbuckner commented Oct 6, 2018

Adding a MatchBytes() to match a glob pattern against a byte slice would be incredibly useful for searching within files.

For example:

package main

import "github.com/gobwas/glob"

func main() {
    var g glob.Glob
    
    g = glob.MustCompile("*.github.com")
    g.MatchBytes([]byte("api.github.com")) // true
}

A further justification of this is how the regex package operates on bytes by default. I am not suggesting modifying the default behavior, though, but adding a MatchString() alias could help maintain compatibility if it ever becomes the default.

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

1 participant