Advertisements

headerup to 320x100 / 728x90

Regex Tester

Test and debug regular expressions

Regex Tester

Test a pattern against text, inspect capture groups, and keep the match view visible.

Source
Keep the full source visible while you adjust the pattern or selector.
Loading editor...
Tester
Use a dedicated query field with live result counts and matched values.
4 matches
Pattern
Advertisements

content bottomup to 300x250

What is Regex Tester

Last reviewed:

A regular expression (regex) is a concise pattern language for matching and extracting parts of text, supported across virtually every programming language.

Regex Tester runs your regular expression against a body of text in the browser, highlighting every match and showing each capture group alongside the match position, so you can debug patterns without re-running your script.

The engine is JavaScript's built-in RegExp — the exact same implementation your Node.js or browser code will execute, so a pattern that matches here will match identically in production.

Why use it

  • Debug a complex regex (multi-line, lookaheads, backreferences) with live visual feedback instead of printf-style scripting.
  • Extract capture groups interactively to figure out which sub-pattern should produce which value.
  • Validate that a regex actually handles edge cases (empty input, Unicode, anchors) before shipping it.

Features

  • Live highlighting of every match, updated on every keystroke with debouncing on large inputs
  • Per-match capture group breakdown with index, value, and position in the input
  • Flag toggles for g (global), i (case-insensitive), m (multiline), s (dotAll), u (unicode), y (sticky)
  • Replacement preview: enter a substitution string and see the transformed output live
  • Shareable URL encodes the pattern, flags, and input so teammates can reproduce the test

How to use Regex Tester

  1. Type your regex. Enter the pattern in the top field. Syntax highlighting flags invalid characters in red as you type.
  2. Paste sample input. Drop the text you want to match into the input editor. Matches highlight in real time.
  3. Toggle flags. Check or uncheck flags (g, i, m, s, u, y). The toolbar updates the pattern immediately so you can see the effect of each.
  4. Inspect capture groups. Click any highlighted match in the input. The sidebar expands to show every capture group with its index and matched text.
  5. Preview a replacement (optional). Open the Replace tab, enter a substitution string (supports $1, $2, named groups), and the output pane shows the post-replacement text.

Example (before/after)

Regex input

Start with the regex input you want to process in Regex Tester.

Regex output

Get a regex result from Regex Tester that is ready to review, copy, and reuse in the next step of your workflow.

Common errors

Unsupported input

The tool may reject input that does not match the expected content, structure, or file type.

Fix: Confirm the tool input requirements and paste the correct type of data.

Incomplete values

Missing fields or partial content can block processing or produce weak results.

Fix: Provide the full required input before running the tool.

Copying placeholder content

Sample or placeholder values can lead to output that looks valid but is not ready for real use.

Fix: Replace placeholders with your actual values before relying on the result.

FAQ

Does the Regex Tester support PCRE features like possessive quantifiers?

No. The tester uses the JavaScript regex engine, which covers ~99% of PCRE for common features (character classes, quantifiers, lookaheads, groups, backreferences). Possessive quantifiers, recursive patterns, and PCRE-specific modifiers are not supported — the tool flags them on paste.

Can I test regex with the new /u Unicode flag?

Yes. The /u flag enables full Unicode handling — /\p{Letter}/u matches any Unicode letter, surrogate pairs are treated as single code points, and Unicode property escapes (\p{Emoji}, \p{Script=Greek}) all work. Toggle /u in the flag bar.

How does named capture group syntax work?

Use (?<name>pattern) to create a named capture. The sidebar shows each named group alongside its index. In the Replace tab, reference the group as $<name> in the substitution string.

Is there a way to save a regex for later?

The URL in your address bar encodes the current pattern, flags, and input — copy it to bookmark the test or share it with a teammate. Loading the URL restores the full session exactly.

How big an input can the Regex Tester handle?

Comfortably up to 5 MB of text (about 50,000 lines of code or a large JSON log file). Beyond that, live highlighting gets sluggish — the tool debounces updates to keep typing responsive and warns you if backtracking explodes.

Does the tester warn about catastrophic backtracking?

Yes. A watchdog monitors execution time; if a pattern takes longer than 500ms, the tool halts and warns that the regex likely has catastrophic backtracking (nested quantifiers, ambiguous alternation). A link in the warning suggests typical refactors to fix the issue.