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 |
✅ |