Expand description
This crate provides the fnmatch function that performs pattern matching
based on a globbing pattern.
This implementation supports the following syntax in patterns:
- Any single character (
?) - Any character sequence (
*) - Bracket expression (
[...])- Character literals
- Character ranges (e.g.
a-z) - Complement (
[!...]) - Collating symbols (e.g.
[.ch.]) - Equivalence classes (e.g.
[=a=]) - Character classes (e.g.
[:alpha:])
The current implementation does not support any locale-specific characteristics. Especially, collating symbols and equivalent classes only match the specified character sequence itself, and character classes only match ASCII characters.
This crate is very similar to the fnmatch-regex crate in that both
perform matching by converting the pattern to a regular expression. The
yash-fnmatch crate tries to support the POSIX specification as much as
possible rather than introducing unique (non-portable) functionalities.
§Example
use yash_fnmatch::{Pattern, without_escape};
let p = Pattern::parse(without_escape("r*g")).unwrap();
assert_eq!(p.find("string"), Some(2..6));Modules§
- ast
- Abstract syntax tree for globbing patterns
Structs§
- Config
- Configuration for a pattern
- Pattern
- Compiled globbing pattern
- With
Escape - Iterator returned by
with_escape - Without
Escape - Iterator returned by
without_escape
Enums§
- Error
- Error that may happen in building a pattern.
- Pattern
Char - Character appearing in patterns
Functions§
- with_
escape - Adapts an escaped string for input to a parser.
- without_
escape - Adapts a literal string for input to a parser.