Skip to main content

rulecc

English | 中文

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

安装

pip install rulecc

用法

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


English

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

Install

pip install rulecc

Usage

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

Metadata

Release files for rulecc 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rulecc 0.0.5
File Size Uploaded Provenance Actions
rulecc-0.0.5.tar.gz 3.3 kB Without provenance Details for rulecc-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rulecc 0.0.5
File Interpreter ABI Platform Actions
rulecc-0.0.5-py3-none-any.whl Python 3 none any Details for rulecc-0.0.5-py3-none-any.whl

Total release size: 6.9 kB

Release files / rulecc-0.0.5.tar.gz

Download URL rulecc-0.0.5.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7fb9d28b6218c35470459b5fc5680ee1efe9b91a8300324b3fb461267c6d641c
BLAKE2b-256 checksum
How to use checksums
388b0aec2c694c6ac7c01d25563e696af26f66c9c7072a044d99404eaeaaa686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / rulecc-0.0.5-py3-none-any.whl

Download URL rulecc-0.0.5-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7418c0f6560df7b7a3595b1c8834bb273acc0827faca4619f0dca8f9850b07c
BLAKE2b-256 checksum
How to use checksums
2ba832241a6c9719c7b9eadbc4472a805a1a5e26de093ee4f6d5ebbf6d8e2e44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for rulecc 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page