Crate wildmatch[][src]

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.

No escape characters are defined.

  • ? matches exactly one occurrence of any character.
  • * matches arbitrary many (including zero) occurrences of any character.

Examples matching wildcards:

assert!(WildMatch::new("cat").is_match("cat"));
assert!(WildMatch::new("*cat*").is_match("dog_cat_dog"));
assert!(WildMatch::new("c?t").is_match("cat"));
assert!(WildMatch::new("c?t").is_match("cot"));

Examples not matching wildcards:

assert!(!WildMatch::new("dog").is_match("cat"));
assert!(!WildMatch::new("*d").is_match("cat"));
assert!(!WildMatch::new("????").is_match("cat"));
assert!(!WildMatch::new("?").is_match("cat"));

Structs

WildMatch

Wildcard matcher used to match strings.