Check Python Regex Captures and Substitution with re
Admin ·
Use Python Regex Tester when a pattern should follow Python’s standard re module. The browser uses CPython 3.13.2 through Pyodide 0.29.3. The interpreter loads from this site when a test begins. Patterns and text stay on your device.
Verify the named date groups after an emoji
Select Named date groups. The first line contains a leaf emoji, a space and the date 2026-11-21. Press Test pattern and expect two matches. The first whole match starts at Python index 2 and ends just before index 12.
Select the first match and verify year at 2–6, month at 7–9, and day at 10–12. The second full match is at 20–30. The leaf is one Python code point although its UTF-16 representation has two code units. The test matches the date’s shape and leaves calendar validation to a separate check.
Open the Python Regex TesterPython 3.13 re function and syntax reference
Reproduce a named replacement outside the browser
Select Repeated word, run sub and expect This is a sample. The pattern remembers a word in a named group and then matches the same word again. The replacement inserts the value of the word group once.
Open Reproduce in Python, copy the sample code and run it with Python 3.13. The output should match the tool’s Operation result. The code contains the entered text and pattern when you copy it.
Open the Python Regex TesterPython 3.13 re function and syntax reference
Choose an operation and interpret a partial match list
Use search for the first match anywhere, match for a match starting at the first position, and fullmatch for a pattern that must cover the complete string. findall returns values and finditer returns match evidence. split returns parts, including captured delimiters.
The viewer keeps up to 200 match records. Find operations may stop when another match establishes that the preview is partial. Split and replacement return complete output within their documented limits or display an error. Cancel stops the worker. A complex pattern also stops after the match deadline.
Python 3.13 re function and syntax referencePyodide 0.29.3 deployment and worker documentation
Common questions
How do I match a line within a multi-line string?
Enable MULTILINE so ^ and $ recognize line boundaries. Enable DOTALL separately when . should match a line feed.
What does Did not participate mean?
The group was optional or belonged to an alternative that did not match. A participating group that captured no characters instead has equal start and end positions. The JSON preserves this distinction with null for a missing span.
What should I do if Python reaches the match time limit?
Try a shorter sample and simplify the pattern before testing again. The two-second deadline measures matching after the interpreter is ready.