# wildmatch
[](https://github.com/becheran/wildmatch/actions?workflow=Build)
[](https://docs.rs/wildmatch)
[](https://crates.io/crates/wildmatch)
[](https://crates.io/crates/wildmatch)
[](https://opensource.org/licenses/MIT)
[](https://codecov.io/gh/becheran/wildmatch)
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.
Can also be used with a [custom match pattern](https://docs.rs/wildmatch/latest/wildmatch/struct.WildMatchPattern.html) to define own wildcard patterns for single and multi-character matching.
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`.
Compared to the [rust regex library](https://crates.io/crates/regex), wildmatch pattern compile much faster and match with about the same speed. Compared to [glob pattern](https://docs.rs/glob/0.3.0/glob/struct.Pattern.html) wildmtach is faster in both compile and match time:
| compiling/text | **340 ns** | 39,714 ns | 1,470 ns | 13,210 ns
| compiling/complex | 70 ns | 153,830 ns | 255,780 ns | **60 ns**
| matching/text | **367 ns** | 3,882 ns | 440 ns | 6,097 ns
| matching/complex | **376 ns** | 16,024 ns | 1,526 ns | 3,773 ns
The library only depends on the rust [`stdlib`](https://doc.rust-lang.org/std/).
See the [documentation](https://docs.rs/wildmatch) for usage and more examples.