onigurumacffi
python cffi bindings for the oniguruma regex engine
What it is and what it does
onigurumacffi is a thin CFFI wrapper around the Oniguruma regex engine, exposing its pattern matching and searching capabilities to Python. It lets you compile regex patterns and RegSets, then match or search strings with optional position offsets and search flags. The package provides match objects with group extraction, position tracking, and span information.
The API is intentionally minimal—it covers core pattern compilation, matching, searching, and capture group access. It's useful when you need Oniguruma's regex dialect or features that Python's built-in re module doesn't offer, but it's not a drop-in replacement for the standard library. The package requires Python 3.10+ and depends only on cffi; wheels are available for most platforms, though source builds need libonig-dev.
Use it for:
- Use it when you need Oniguruma's specific regex syntax or features not available in Python's built-in re module.
- Use it to compile and reuse complex regex patterns for high-throughput string matching in text processing pipelines.
- Use it to search multiple patterns simultaneously via RegSet for efficient multi-pattern matching.
- Use it in syntax highlighters or code analysis tools that rely on Oniguruma's regex dialect.
- Use it when integrating with systems or libraries that already use Oniguruma and need consistent regex behavior.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python bindings to the Oniguruma regex engine via CFFI, enabling pattern matching and searching with Oniguruma's regex features.
Yes, if you specifically need Oniguruma's regex features or dialect. The package is actively maintained, has no known vulnerabilities, and is permissively licensed. Install friction is moderate due to compiled bindings but wheels are available for common platforms. If you're looking for a general-purpose regex library, Python's built-in re module is simpler; install this only if Oniguruma's specific capabilities are required.
Install
onigurumacffi on PyPI
pip
pip install onigurumacffiuv
uv add onigurumacffipoetry
poetry add onigurumacffiInstalling onigurumacffi
Before you install
Medium install friction due to compiled CFFI bindings; wheels are available for common platforms (macOS arm64/x86_64, Linux x86_64, Windows 32/64-bit, PyPy) but source builds require libonig-dev. Package is actively maintained with recent commits and no known vulnerabilities.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install onigurumacffi
import onigurumacffi
pattern = onigurumacffi.compile(r'\w+')
match = pattern.search('test string')
if match:
print(match.group(0))
Source builds require libonig-dev to be installed before pip install; prebuilt wheels are available for most platforms.
Verify before relying
- Whether the API's current limited scope covers your specific regex use case.
- Performance characteristics compared to Python's built-in re module or other regex engines.
- Compatibility with specific Oniguruma regex features you plan to rely on.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 1 — cffi |
| Maintenance | actively maintained — 201 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 472,834/month — #6,473 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_arm64.whl; onigurumacffi-1.5.0-cp310-abi3-macosx_15_0_x86_64.whl; onigurumacffi-1.5.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl; onigurumacffi-1.5.0-cp310-abi3-win32.whl; onigurumacffi-1.5.0-cp310-abi3-win_amd64.whl; onigurumacffi-1.5.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
real-regexA drop-in replacement for Python's `re` module…
permissive · top 15,000 on PyPI
interegularInteregular checks whether pairs of Python…
permissive · top 5,000 on PyPI
google-re2A drop-in replacement for Python's re module…
permissive · top 5,000 on PyPI
rebulkReBulk provides a fluent API for building…
permissive · top 15,000 on PyPI
brotlicffiProvides Python CFFI bindings to the Brotli…
permissive · top 5,000 on PyPI
multiregexMatches multiple regex patterns against a…
permissive · top 15,000 on PyPI
fuzzysearchFinds approximate substring matches in text or…
permissive · top 15,000 on PyPI
flpcflpc wraps the Rust regex crate to provide…
permissive · top 5,000 on PyPI
hyperscanPython bindings for Vectorscan (an open-source…
permissive · top 15,000 on PyPI