skillfed

onigurumacffi

python cffi bindings for the oniguruma regex engine

onigurumacffi v1.5.0 472.8K downloads/30d#6,473 on PyPI22
Permissive license MIT Active released

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 onigurumacffi

uv

uv add onigurumacffi

poetry

poetry add onigurumacffi

Installing 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

Programming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy

Tags

oniguruma regex pythoncffi regex bindingsadvanced pattern matchingoniguruma engine bindingsregex search librarypattern compilationregex engine wrapper
regex-enginecffi-bindingpattern-matching

More Text Processing packages