Skip to content

Simple string matching with questionmark- and star-wildcard operator

License

Notifications You must be signed in to change notification settings

RyanMarcus/wildmatch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

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, wildmatch pattern compile much faster and match with about the same speed. Compared to glob pattern wildmtach is faster in both compile and match time:

Benchmark wildmatch regex glob
compiling/text 990 ns 476,980 ns 4,517 ns
compiling/complex 122 ns 177,510 ns 562 ns
matching/text 568 ns 655 ns 1,896 ns
matching/complex 664 ns 575 ns 4,208 ns

The library only depends on the rust stdlib.

See the documentation for usage and more examples.

About

Simple string matching with questionmark- and star-wildcard operator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%