google-re2
RE2 Python bindings
Decision gist · record as of 2026-08-14
Yes, if you need predictable regex performance and can accept RE2's syntax limitations. The permissive license and active repository are favorable. Medium install friction (system libraries required) and aging maintenance status (282 days since release) are minor concerns; the underlying RE2 engine is mature and the package has no known vulnerabilities. Not suitable if your patterns rely on backreferences, lookarounds, or other PCRE-only features.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires RE2 library and pybind11 to be installed on your system before installation; precompiled wheels available for Python 3.9+ on common platforms.
- Medium install friction: precompiled wheels are available for current Python versions on macOS, Linux, and Windows, but building from source requires RE2 and pybind11 system libraries.
- The package is aging (282 days since last release) but the underlying repository remains active.
License · maintenance · safety
permissive license (permissive) — Permissive license (BSD) means you can use, modify, and distribute this package with minimal restrictions, though you should include the license notice in distributions.
last release 2025-11-05 (282 days) · last repo commit 2026-01-22 · 9,781 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 16,109,027 downloads/mo, #1,161 on PyPI
Alternatives
Verify before relying
import re2
pattern = re2.compile(r'\w+')
match = pattern.search('hello world')
if match:
print(match.group())- Performance characteristics compared to standard re module in typical workloads
- Compatibility with third-party libraries that expect the standard re module API
- Current status of Windows build support (documentation notes it has not been tested)
What it is and what it does
google-re2 wraps Google's RE2 regular expression engine as a Python module that mimics the standard re module's interface. It trades support for some advanced PCRE features—like backreferences and lookaround assertions—for guaranteed linear-time matching and immunity to catastrophic backtracking, making it suitable for processing untrusted input or patterns where performance predictability matters.
The package is a compiled C++ extension, so installation uses prebuilt wheels when available. Its API closely mirrors Python's re module, but with notable differences: pattern and input strings don't need to match types (str is encoded to UTF-8), the Options class replaces re flags with RE2's own options, and error reporting is minimal. The description notes several syntax gotchas relative to Python's re—most notably that \Z must be rewritten as \z.
Use it for
- Processing untrusted regex patterns or input where catastrophic backtracking is a security concern
- High-throughput text processing where predictable linear-time performance is required
- Migrating from re to a safer engine when PCRE features like backreferences are not needed
- Building systems that need consistent regex behavior across different input types without type coercion
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need predictable regex performance and can accept RE2's syntax limitations.
The permissive license and active repository are favorable. Medium install friction (system libraries required) and aging maintenance status (282 days since release) are minor concerns; the underlying RE2 engine is mature and the package has no known vulnerabilities. Not suitable if your patterns rely on backreferences, lookarounds, or other PCRE-only features.
Install
google-re2 on PyPI
Before you install
Medium install friction: precompiled wheels are available for current Python versions on macOS, Linux, and Windows, but building from source requires RE2 and pybind11 system libraries. The package is aging (282 days since last release) but the underlying repository remains active.
Requires RE2 library and pybind11 to be installed on your system before installation; precompiled wheels available for Python 3.9+ on common platforms.
License in practice
Permissive license (BSD) means you can use, modify, and distribute this package with minimal restrictions, though you should include the license notice in distributions.
Quickstart
import re2
pattern = re2.compile(r'\w+')
match = pattern.search('hello world')
if match:
print(match.group())
Verify before relying
- Performance characteristics compared to standard re module in typical workloads
- Compatibility with third-party libraries that expect the standard re module API
- Current status of Windows build support (documentation notes it has not been tested)
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release ~=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Aging 282 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 16,109,027 / month, #1,161 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseProgramming Language :: C++Programming Language :: Python :: 3.9 |
Evidence: google_re2-1.1.20251105-1-cp310-cp310-macosx_13_0_arm64.whl; google_re2-1.1.20251105-1-cp310-cp310-macosx_13_0_x86_64.whl; google_re2-1.1.20251105-1-cp310-cp310-macosx_14_0_arm64.whl; google_re2-1.1.20251105-1-cp310-cp310-macosx_14_0_x86_64.whl; google_re2-1.1.20251105-1-cp310-cp310-macosx_15_0_arm64.whl; google_re2-1.1.20251105-1-cp310-cp310-macosx_15_0_x86_64.whl; google_re2-1.1.20251105-1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; google_re2-1.1.20251105-1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; google_re2-1.1.20251105-1-cp310-cp310-win32.whl; google_re2-1.1.20251105-1-cp310-cp310-win_amd64.whl; google_re2-1.1.20251105-1-cp311-cp311-macosx_13_0_arm64.whl; google_re2-1.1.20251105-1-cp311-cp311-macosx_13_0_x86_64.whl; google_re2-1.1.20251105-1-cp311-cp311-macosx_14_0_arm64.whl; google_re2-1.1.20251105-1-cp311-cp311-macosx_14_0_x86_64.whl; google_re2-1.1.20251105-1-cp311-cp311-macosx_15_0_arm64.whl; google_re2-1.1.20251105-1-cp311-cp311-macosx_15_0_x86_64.whl; google_re2-1.1.20251105-1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; google_re2-1.1.20251105-1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; google_re2-1.1.20251105-1-cp311-cp311-win32.whl; google_re2-1.1.20251105-1-cp311-cp311-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “re2 regex engine python”
- google-re2A drop-in replacement for Python's re module that uses Google's RE2…
- google-re2-stubsProvides type stubs for the google-re2 package, enabling static type…
- onigurumacffiProvides Python bindings to the Oniguruma regex engine via CFFI,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Text Processing packages
A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.
Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.
tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Install it if your project requires CSS tokenization or syntax manipulation.
See also google-re2-stubs · real-regex · backrefs · onigurumacffi · re-assert · flpc · cel-python · repath