main
kpmatch
A path matching library.
Features
- Bash-style pathname patterns
- Curly braces syntax:
a{/b/c,bc}expands intoa/b/candabc - Pattern specificity ranking: patterns can be sorted to test a path against the more specific patterns first
- Pure paths: This library does not access the filesystem. It does not check if a path exists and does not differentiate between files and directories. If you need to search files, use Python's built-in glob module or a library like wcmatch.
- Ranges
[0-9], character classes[:space:]are not supported. - The extended operators
?(...),*(...),+(...),@(...)and!(...)are not supported.
Features
Pattern Syntax
Braced sections { , } are expanded.
Path patterns should always use forward slashes / between segments.
The actual separator used when matching paths depends on the system.
A path segment containing two asterisks /**/ matches zero, one or more
segments.
A single asterisk * matches zero, one or more characters except a path
separator.
A question mark ? matches exactly one character unless it's a path
separator.
Square brackets [ ] can match one of the characters between the brackets.
If the first character is an exclamation point [! ], it will match one
character that does NOT appear between the brackets.
Languages
Python
100%