becheran/wildmatch

Simple string matching with single- and multiple-wildcard operator

Rust

98

73 commits

updated Sep 24, 2026

See the code

README

wildmatch

build status docs downloads crate license codecov

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

The following table shows a performance benchmarks between wildmatch, regex,glob, and the regex_lite libraries:

Benchmarkwildmatchregexglobregex_lite
compiling/text462 ns39,714 ns1,470 ns13,210 ns
compiling/complex190 ns153,830 ns238 ns60 ns
matching/text186 ns4,065 ns456 ns6,097 ns
matching/complex310 ns16,085 ns1,426 ns3,773 ns

The library only depends on the rust stdlib.

See the documentation for usage and more examples.

globbing
matching-algorithm
questionmark
rust-lang
star
string-matching
wildcard

becheran/wildmatch

Simple string matching with single- and multiple-wildcard operator

Rust

98

73 commits

updated Sep 24, 2026

See the code

README

wildmatch

build status docs downloads crate license codecov

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

The following table shows a performance benchmarks between wildmatch, regex,glob, and the regex_lite libraries:

Benchmarkwildmatchregexglobregex_lite
compiling/text462 ns39,714 ns1,470 ns13,210 ns
compiling/complex190 ns153,830 ns238 ns60 ns
matching/text186 ns4,065 ns456 ns6,097 ns
matching/complex310 ns16,085 ns1,426 ns3,773 ns

The library only depends on the rust stdlib.

See the documentation for usage and more examples.

globbing
matching-algorithm
questionmark
rust-lang
star
string-matching
wildcard

Significant stargazers

Louis Maddox

214 followers · starred Apr 2025

sbstp

92 followers · starred Feb 2020

xixi

286 followers · starred May 2021