--- id: backrefs version: "8.0" license: MIT license_treatment: permissive maintenance: active --- # backrefs — A wrapper around re and regex that adds additional back references. License: permissive · Maintenance: active · Downloads: 13.5M/mo ## What it is and what it does Backrefs is a wrapper around Python's built-in re module and the third-party regex library that adds backreference syntax and features not available in either engine natively. It enables patterns like Unicode property escapes (\p{Letter}) and case-conversion backreferences (\C, \E) that are common in other regex engines but absent from Python's standard tools. The package is designed for developers who need advanced regex capabilities within Python without rewriting patterns or switching languages. It sits as a compatibility layer, translating extended syntax into operations the underlying engine can execute. With no runtime dependencies and support for current Python versions, it integrates as a drop-in replacement for re or regex in projects requiring these additional features. Use it for: - Converting matched text to uppercase or other cases using backreferences in substitutions. - Writing regex patterns with Unicode property classes like \p{Letter} or \p{Digit}. - Porting regex patterns from other languages that support extended backreferences into Python. - Processing multilingual text where Unicode character properties simplify pattern matching. - Building text transformation pipelines that rely on advanced regex features. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Backrefs extends Python's re and regex libraries with additional backreference features and syntax not natively supported, such as Unicode property escapes and case-conversion backreferences. Yes, if you need extended regex features like Unicode properties or case-conversion backreferences. The package is actively maintained, has no dependencies, installs easily, carries a permissive MIT license, and ranks in the top 5000 PyPI packages. Install only if your patterns genuinely require features beyond standard re or regex; otherwise, the added layer is unnecessary. ## Install pip install backrefs uv add backrefs poetry add backrefs ## Installing backrefs Before you install: Low friction installation with wheels available for Python 3.10 through 3.14. Package is actively maintained with a recent release (19 days ago) and no runtime dependencies. License in practice: MIT license permits unrestricted use, modification, and distribution in commercial and private projects with minimal attribution requirements. Quickstart: from backrefs import bre pattern = bre.compile(r'(\p{Letter}+)') result = pattern.sub(r'\C\1\E', 'sometext') Requires Python 3.10 or later. Verify before relying: - Whether the package wraps both re and regex engines or primarily one of them in typical usage. - Performance overhead compared to direct re or regex library calls. - Scope and completeness of backreference features supported across different regex engines. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 13.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags regex backreferences, extended regex features, unicode property escapes, case conversion regex, python regex wrapper, advanced regex patterns, regex enhancements, regex-wrapper, unicode-patterns, text-processing [View on SkillFed](https://skillfed.io/packages/backrefs) · [View on PyPI](https://pypi.org/project/backrefs/)