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.4

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.4
File Size Uploaded Provenance Actions
rulecc-0.0.4.tar.gz 3.3 kB Without provenance Details for rulecc-0.0.4.tar.gz

Built distribution (wheel)

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

Total release size: 6.9 kB

Release files / rulecc-0.0.4.tar.gz

Download URL rulecc-0.0.4.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
64a3f2183f143d64d282fa85f90fb6cadb7ad0b109b03d21c47fdf36ba203fad
BLAKE2b-256 checksum
How to use checksums
6a869144c0b969e2ea87c124844314b1622fe3f030c670ea5f6260cdd7127874
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.4-py3-none-any.whl

Download URL rulecc-0.0.4-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be55c59a31d7194eaa6a2c22f872a6059b148c6a43d2352cfb1e20ec87bd239c
BLAKE2b-256 checksum
How to use checksums
e823b0ad69594f21a6a1cacecbaf71305760fcd07835284035d05e1fdb6e06ee
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.4

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