regex

raw JSON →
2026.2.28 verified Tue May 12 auth: no python install: verified quickstart: verified

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.

pip install regex
breaking The regex module is incompatible with PyPy due to differing string storage methods.
fix Use CPython for compatibility.
gotcha The regex module releases the GIL during matching, which can lead to concurrency issues if the string is modified during matching.
fix Ensure the string remains unchanged during matching when using concurrent=True.
python os / libc status wheel install import disk
3.10 alpine (musl) - - 0.04s 20.4M
3.10 slim (glibc) - - 0.03s 21M
3.11 alpine (musl) - - 0.27s 22.6M
3.11 slim (glibc) - - 0.20s 24M
3.12 alpine (musl) - - 0.12s 14.4M
3.12 slim (glibc) - - 0.13s 15M
3.13 alpine (musl) - - 0.03s 14.1M
3.13 slim (glibc) - - 0.03s 15M
3.9 alpine (musl) - - 0.03s 19.9M
3.9 slim (glibc) - - 0.03s 21M

Basic usage of the regex module to find all words in a text.

import regex

pattern = r'\b\w+\b'
text = 'Hello, world!'
matches = regex.findall(pattern, text)
print(matches)