regex
An alternative regular expression module designed to replace Python's built-in 're' module, offering additional functionality. Current version: 2026.2.28. Release cadence: Regular updates.
Warnings
- breaking The regex module is incompatible with PyPy due to differing string storage methods.
- gotcha The regex module releases the GIL during matching, which can lead to concurrency issues if the string is modified during matching.
Install
-
pip install regex
Imports
- regex
import regex
Quickstart
import regex pattern = r'\b\w+\b' text = 'Hello, world!' matches = regex.findall(pattern, text) print(matches)