Files
kpmatch/README.md
Louis DEVIE ed2af16329
Some checks failed
Run tests / build (push) Failing after 2s
run tests in CI
2026-04-14 02:57:20 +02:00

43 lines
1.4 KiB
Markdown

# kpmatch
A path matching library.
## Features
* **Bash-style pathname patterns**
* **Curly braces syntax:** `a{/b/c,bc}` expands into `a/b/c` and `abc`
* **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](https://github.com/facelessuser/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.