Skip to main content

wildcard_match

Function wildcard_match 

Source
pub fn wildcard_match(name: &str, pattern: &str) -> bool
Expand description

Glob-style filename matcher supporting * (any run of characters, including none) and ? (exactly one character), via a straightforward O(n·m) dynamic-programming table over the two strings’ characters.

Case-sensitive by itself, hooks::query_dir’s hook lowercases both the candidate name and the pattern before calling this, and any other caller wanting case-insensitive matching is responsible for doing the same; see is_case_sensitive_by_itself below.