Regex Tester

Test regular expressions with live highlighting.

Free regex tester. Try a pattern with flags against your text and see highlighted matches, a match list with positions, and counts, with friendly invalid-pattern errors.

Loading tool…

If the tool stays on this message, make sure JavaScript is enabled, then reload the page.

About Regex Tester

Regular expressions are a tiny language for describing text patterns, a few characters that can validate an email, extract every URL from a page, or find all the dates in a document. They're also famously write-once, read-never: a pattern that made sense at 2 AM is hieroglyphics by morning. Testing as you build is the difference between confidence and superstition.

This tester runs your pattern against your text using JavaScript's RegExp engine, with support for the g, i, m, s, u, and y flags. You get live highlighting of every match, a match list with character positions, and a total count, plus plain-language errors when a pattern fails to compile, pointing at the actual problem instead of dumping engine jargon.

Patterns are capped at 2,000 characters and test text at 50,000 to keep the page responsive, generous headroom for real-world patterns. Build incrementally, test against text that should match and text that shouldn't, and let the match positions show you what your pattern really captures versus what you assumed.

How to use Regex Tester

  1. Enter your pattern and flags (e.g. g i m).
  2. Paste the test string and click Test.
  3. Review highlighted matches, positions and the total count.

Why use this tool?

  • Live highlighting of every match
  • Match list with character positions
  • Invalid patterns explained in plain language

Tips for best results

  • Test against text that should NOT match too, a pattern that matches everything is a bug, not a success.
  • Escape special characters (. * + ? ( ) [ ] { } ^ $ | \) when you mean them literally, unescaped dots are the classic mistake.
  • Anchor with ^ and $ when the whole string must match; without them, partial matches count.
  • Prefer specific character classes like \d or [a-z] over .*, greedy dot-stars are the main source of surprising matches.
  • Watch out for nested quantifiers like (a+)+. They can cause catastrophic backtracking that hangs the page.
  • Use the match positions to debug: seeing WHERE it matched often reveals what the pattern really does.

Frequently asked questions

Which regex flavor is used?
JavaScript's RegExp engine, with flags g i m s u y supported.
Why did my pattern fail to compile?
Common causes are unclosed brackets or parentheses and bad escapes, the error message points at the problem.
Is my test data uploaded?
No. Everything runs locally in your browser.
Are there input limits?
Patterns are capped at 2,000 characters and test text at 50,000 to keep the page responsive.
What does the 'g' flag do?
Global matching finds every match in the text instead of stopping at the first one. Without it, you'll only see the first match highlighted.

Related tools