Metadata-Version: 2.5
Name: rulecc
Version: 0.0.5
Summary: Shell 风格通配符匹配，`*` 不过 `/`，`**` 可以。
Project-URL: Homepage, https://pypi.org/project/rulecc/
Author-email: lqxnjk <lqxnjk@qq.com>
License: MIT
License-File: LICENSE
Keywords: glob,match,path,pattern,wildcard
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# rulecc

[English](#english) | 中文

Shell 风格通配符匹配，`*` 不过 `/`，`**` 可以。

## 安装

```console
pip install rulecc
```

## 用法

```python
from rulecc import compile_wildcard, wildcard_match

wildcard_match("*.py", "app.py")          # True
wildcard_match("*.py", "pkg/app.py")      # False
wildcard_match("**/*.py", "pkg/app.py")   # True
wildcard_match("a?c", "abc")              # True
wildcard_match("[!abc]x", "bx")           # False

pattern = compile_wildcard("*.txt")        # 复用已编译的模式
pattern.match("a.txt")
```

## 说明

和 `fnmatch` 的关键差异：`*` 不跨越路径分隔符，`**` 才跨；`**/x` 还能匹配裸的 `x`。未知的 `[` 未闭合时按字面量处理，不抛错。

## 许可证

MIT

---

<a id="english"></a>
## English

Shell-style wildcard matching with ** for path segments.

## Install

```console
pip install rulecc
```

## Usage

```python
from rulecc import compile_wildcard, wildcard_match

wildcard_match("*.py", "app.py")          # True
wildcard_match("*.py", "pkg/app.py")      # False
wildcard_match("**/*.py", "pkg/app.py")   # True
wildcard_match("a?c", "abc")              # True
wildcard_match("[!abc]x", "bx")           # False

pattern = compile_wildcard("*.txt")        # 复用已编译的模式
pattern.match("a.txt")
```

## Notes

The difference from `fnmatch`: `*` stops at `/`, only `**` crosses it, and `**/x` also matches a bare `x`. An unterminated `[` is treated literally.

## License

MIT
