Expand description
fast-glob
is a high-performance glob matching crate for Rust, originally forked from devongovett/glob-match
.
This crate provides efficient glob pattern matching with support for multi-pattern matching and brace expansion.
§Key Features
- Up to 60% performance improvement.
- Support for more complex and efficient brace expansion.
- Fixed matching issues with wildcard and globstar
glob-match/issues#9
.
§Examples
use fast_glob::glob_match;
let glob = "some/**/n*d[k-m]e?txt";
let path = "some/a/bigger/path/to/the/crazy/needle.txt";
assert!(glob_match(glob, path));
§Syntax
fast-glob
supports the following glob pattern syntax:
Syntax | Meaning |
---|---|
? | Matches any single character. |
* | Matches zero or more characters, except for path separators (e.g., / ). |
** | Matches zero or more characters, including path separators. Must match a complete path segment (i.e., followed by a / or the end of the pattern). |
[ab] | Matches one of the characters contained in the brackets. Character ranges, e.g., [a-z] , are also supported. Use [!ab] or [^ab] to match any character except those contained in the brackets. |
{a,b} | Matches one of the patterns contained in the braces. Any of the wildcard characters can be used in the sub-patterns. Braces may be nested up to 10 levels deep. |
! | When at the start of the glob, this negates the result. Multiple ! characters negate the glob multiple times. |
\ | A backslash character may be used to escape any of the above special characters. |
For detailed usage and API reference, refer to the specific function and struct documentation.
For any issues or contributions, please visit the GitHub repository.