This is fnmatch implementation inspired by github.com/danwakefield/fnmatch
and heavily based on Ruby File.fnmatch.
go get github.com/iarkhanhelsky/fnmatch.v2
import "github.com/iarkhanhelsky/fnmatch.v2"
func main() {
if fnmatch.Match("foo/*", "foo/bar") {
println("Matched!")
}
}| Feature | fnmatch.v2 | golang | fnmatch | ruby |
|---|---|---|---|---|
* |
✅ | ✅ | ✅ | ✅ |
? |
✅ | ✅ | ✅ | ✅ |
Character range (i.e. [A-Z]) |
✅ | ✅ | ✅ | ✅ |
| Windows separator | ✅ | ✅ | ||
| Recursive match | ✅ | ✅ | ||
FNM_NOESCAPE |
✅ | ✅ | ✅ | |
FNM_PATHNAME |
✅ | ✅ | ✅ | |
FNM_PERIOD |
✅ | ✅ | ✅ | |
FNM_LEADING_DIR |
✅ | |||
FNM_CASEFOLD |
✅ | ✅ | ✅ | |
FNM_EXTGLOB |
✅ | ✅ | ||
FNM_SHORTNAME (Windows) |
✅ | |||
FNM_SYSCASE |
✅ |