Regex Tester

Free online regex tester — see highlighted matches, capture groups, and a live replacement preview, entirely in your browser.

Developer ToolsRegex

Test a regular expression against your own text and see every match highlighted instantly. Matching happens locally in your browser using JavaScript’s own regex engine — nothing you type here is uploaded, stored, or logged.

Your pattern and test text are matched locally in your browser using native JavaScript. Nothing is uploaded to our server.

Flags

How to Use

  1. Type a regular expression into the Pattern field (without the surrounding slashes) and tick any Flags you need.
  2. Paste the text you want to test into Test string.
  3. Click Test to see every match highlighted, plus each match’s position and capture groups.
  4. Optionally fill in Replacement (supports $1, $2, $&, and named group syntax) to preview what the text looks like after replacing every match.

When You’d Use This

Regular expressions show up constantly in day-to-day development: validating a form field’s format, extracting a value out of a log line, writing a search-and-replace across a codebase, or configuring a route/redirect rule. This tool lets you build and check a pattern against real example text — including edge cases you’re worried about — before dropping it into actual code.

Flags Explained

  • g (global) — find every match in the text, not just the first. Also required for Replacement to replace every occurrence rather than only the first.
  • i (case-insensitive) — A and a are treated as equivalent.
  • m (multiline) — ^ and $ match the start/end of each line, not just the start/end of the whole string.
  • s (dot-all) — lets . also match newline characters, which it otherwise doesn’t.
  • u (unicode) — treats the pattern as a sequence of Unicode code points, which matters for characters outside the Basic Multilingual Plane (e.g. some emoji).

Limitations

  • This tool uses your browser’s own built-in regex engine (JavaScript’s RegExp) — behavior matches JavaScript regex semantics specifically, which differ in some details from PCRE, Python, or other languages’ regex flavors.
  • A pathological pattern (one prone to “catastrophic backtracking,” e.g. (a+)+b against a long run of “a” characters) can make matching take an extremely long time and temporarily freeze this tab — the same thing that would happen if you ran that pattern anywhere else. This tool cannot detect that in advance; if it happens, reload the page.
  • Pattern length and test-string length are capped (500 and 200,000 characters respectively) as a basic safety limit, not a precise performance guarantee.

FAQ

Is my pattern or text uploaded anywhere?

No. Matching happens entirely in your browser using JavaScript’s built-in RegExp. Your pattern and test string are never sent to our server.

Why does my pattern say it’s invalid?

The error message shown is exactly what JavaScript’s own regex engine reports (for example, an unclosed group or an invalid character class) — this tool doesn’t invent its own error messages.

Why didn’t Replacement change every match?

Without the g flag, JavaScript’s replace() only replaces the first match — this tool follows that exact behavior rather than silently forcing global replacement. Tick g to replace every match.

Is there a size limit?

Yes — see Limitations above. These are basic safety caps, not a claim about guaranteed performance for every pattern.

Do I need an account?

No. The tool is free to use and doesn’t require sign-up.