Code · Made a little simpler

Python Regex Tester

Run Python’s re engine in a browser worker. Inspect matches, group spans and named captures. Test splitting or replacements and copy reproducible Python code.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device
Python flags

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

Python Regex Tester: how to use it

  1. Enter a Python pattern without slash delimiters and add a test string.
  2. Choose a re operation and any named flags. Run the pattern or enable Test after edits.
  3. Inspect a match using its code-point start and end. Copy the operation result or download the JSON report.

Limits and notes

CPython 3.13.2 uses up to 50,000 UTF-16 code units of test text and 2,000 each for the pattern and replacement, with up to 32 capture groups. The report previews 200 matches. Split and substitution cap complete output at 200,000 code points and 2,000 matches. A worker stops after two seconds of matching. The first run loads fixed Python runtime files from this site.

How your privacy works →

Python Regex Tester: common questions

Does this tester run actual Python re syntax?

Yes. A local WebAssembly build of CPython runs the standard library’s re module. Named groups use (?P<name>…), and replacement strings can reference them with \g<name>.

Why can the start position differ from my JavaScript offset?

Python counts Unicode code points. JavaScript string offsets count UTF-16 code units. A character such as 🌿 is one code point but two UTF-16 code units.

How do findall and finditer report captures?

findall lists matched values. With one group it returns that group, and with multiple groups it returns one array of capture values per match in the JSON. finditer shows the full match and capture spans, including a distinction between an absent capture and an empty one.

Where do the pattern and test text go?

The page passes them to a worker on the same device. Only the fixed interpreter files are requested. Copy and Download create copies when you select those actions.

Guides