RE2 Python bindings
Project Links
Meta
Author: The RE2 Authors
Requires Python: ~=3.9
Classifiers
Development Status
- 5 - Production/Stable
Intended Audience
- Developers
License
- OSI Approved :: BSD License
Programming Language
- C++
- Python :: 3.9
A drop-in replacement for the re module.
It uses RE2 under the hood, of course, so various PCRE features
(e.g. backreferences, look-around assertions) are not supported.
See https://github.com/google/re2/wiki/Syntax for the canonical
reference, but known syntactic "gotchas" relative to Python are:
* PCRE supports \Z and \z; RE2 supports \z; Python supports \z,
but calls it \Z. You must rewrite \Z to \z in pattern strings.
Known differences between this module's API and the re module's API:
* The error class does not provide any error information as attributes.
* The Options class replaces the re module's flags with RE2's options as
gettable/settable properties. Please see re2.h for their documentation.
* The pattern string and the input string do not have to be the same type.
Any str will be encoded to UTF-8.
* The pattern string cannot be str if the options specify Latin-1 encoding.
Known issues with regard to building the C++ extension:
* Building requires RE2 to be installed on your system.
On Debian, for example, install the libre2-dev package.
* Building requires pybind11 to be installed on your system OR venv.
On Debian, for example, install the pybind11-dev package.
For a venv, install the pybind11 package from PyPI.
* Building on macOS is known to work, but has been known to fail.
For example, the system Python may not know which compiler flags
to set when building bindings for software installed by Homebrew;
see https://docs.brew.sh/Homebrew-and-Python#brewed-python-modules.
* Building on Windows has not been tested yet and will probably fail.
It uses RE2 under the hood, of course, so various PCRE features
(e.g. backreferences, look-around assertions) are not supported.
See https://github.com/google/re2/wiki/Syntax for the canonical
reference, but known syntactic "gotchas" relative to Python are:
* PCRE supports \Z and \z; RE2 supports \z; Python supports \z,
but calls it \Z. You must rewrite \Z to \z in pattern strings.
Known differences between this module's API and the re module's API:
* The error class does not provide any error information as attributes.
* The Options class replaces the re module's flags with RE2's options as
gettable/settable properties. Please see re2.h for their documentation.
* The pattern string and the input string do not have to be the same type.
Any str will be encoded to UTF-8.
* The pattern string cannot be str if the options specify Latin-1 encoding.
Known issues with regard to building the C++ extension:
* Building requires RE2 to be installed on your system.
On Debian, for example, install the libre2-dev package.
* Building requires pybind11 to be installed on your system OR venv.
On Debian, for example, install the pybind11-dev package.
For a venv, install the pybind11 package from PyPI.
* Building on macOS is known to work, but has been known to fail.
For example, the system Python may not know which compiler flags
to set when building bindings for software installed by Homebrew;
see https://docs.brew.sh/Homebrew-and-Python#brewed-python-modules.
* Building on Windows has not been tested yet and will probably fail.
Aug 05, 2025
1.1.20250805
Jul 28, 2025
1.1.20250722
Jul 01, 2024
1.1.20240702
Jun 30, 2024
1.1.20240701
May 31, 2024
1.1.20240601
Apr 30, 2024
1.1.20240501
Jul 31, 2023
1.1
Oct 24, 2022
1.0
May 31, 2022
0.2.20220601
Mar 31, 2022
0.2.20220401
Jan 31, 2022
0.2.20220201
Nov 01, 2021
0.2.20211101
Sep 01, 2021
0.2.20210901
Aug 01, 2021
0.2.20210801
Jul 01, 2021
0.2.20210601
Jun 01, 2021
0.1.20210601
Apr 11, 2021
0.1.20210401
Jun 23, 2020
0.0.7
Apr 05, 2020
0.0.6
Apr 04, 2020
0.0.5
Dec 09, 2019
0.0.4
Sep 26, 2019
0.0.3
Sep 26, 2019
0.0.2
Sep 26, 2019
0.0.1
Sep 26, 2019
0.0.0
Wheel compatibility matrix
Files in release
No dependencies