DEVELOPER TOOL
Python Regex Tester
Test Python re-style regex patterns, including named groups, against text.
Match count
—
About this tool
Test a regular expression written in Python's re style — including (?P<name>...) named groups and (?P=name) backreferences — against sample text, with every match highlighted live and named/numbered groups from the first match broken out separately.
This runs on JavaScript's regex engine as an approximation of Python's re module, translating the syntax that differs (named groups, common flags). The vast majority of everyday patterns behave identically in both, but exotic features — re.VERBOSE mode, possessive quantifiers, atomic groups, and a few edge cases around \A/\Z anchors — aren't emulated. For anything safety-critical, verify against real Python.
Frequently asked questions
- Which Python-specific syntax does this translate?
(?P<name>...)named groups become JavaScript's(?<name>...), and(?P=name)backreferences become\k<name>— both produce equivalent matching behavior.- What does re.DOTALL do?
- By default,
.doesn't match newline characters. re.DOTALL (Python) / thesflag (JavaScript) makes.match any character including newlines — useful for patterns that need to span multiple lines. - Is re.VERBOSE supported?
- No — verbose mode (which lets you write a pattern across multiple lines with whitespace and
#comments for readability) has no JavaScript equivalent, so write your pattern as a single compact expression here.