https://github.com/becheran/wildmatch-go
Simple string matching with questionmark- and star-wildcard operator
https://github.com/becheran/wildmatch-go
globbing go golang matching-algorithm questionmark star string-matching wildcard
Last synced: about 2 months ago
JSON representation
Simple string matching with questionmark- and star-wildcard operator
- Host: GitHub
- URL: https://github.com/becheran/wildmatch-go
- Owner: becheran
- License: mit
- Created: 2021-01-08T15:14:27.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-22T20:00:02.000Z (about 1 year ago)
- Last Synced: 2024-05-22T20:55:19.393Z (about 1 year ago)
- Topics: globbing, go, golang, matching-algorithm, questionmark, star, string-matching, wildcard
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wildmatch go
[](https://godoc.org/github.com/becheran/wildmatch-go)
[](https://pkg.go.dev/github.com/becheran/wildmatch-go)
[](https://sourcegraph.com/github.com/becheran/wildmatch-go?badge)
[](https://goreportcard.com/report/becheran/wildmatch-go)
*golang* library of the original *rust* [wildmatch library](https://github.com/becheran/wildmatch).
``` sh
go get github.com/becheran/wildmatch-go
```Match strings against a simple wildcard pattern. Tests a wildcard pattern `p` against an input string `s`. Returns true only when `p` matches the entirety of `s`.
See also the example described on [wikipedia](https://en.wikipedia.org/wiki/Matching_wildcards) for matching wildcards.
- `?` matches exactly one occurrence of any character.
- `*` matches arbitrary many (including zero) occurrences of any character.
- No escape characters are defined.For example the pattern `ca?` will match `cat` or `car`. The pattern `https://*` will match all https urls, such as `https://google.de` or `https://github.com/becheran/wildmatch`.
The library only depends on the go standard library.