Regex Tester

Test a JavaScript regular expression against text and inspect every match and capture group. Configure flags, use a preset or reference, and see highlighted results without freezing the page on a long-running pattern.

Features

Live pattern matchingSyntax highlightingMatch details with groupsCommon pattern presetsFlag support (g, i, m, s, u, y)Regex reference guide

How to use the Regex Tester

  1. 1Enter a regular-expression pattern without surrounding slashes.
  2. 2Select the JavaScript flags needed for the test.
  3. 3Paste the sample text and review highlighted matches.
  4. 4Inspect match positions and capture groups, then copy the finished pattern.

Common uses

  • Debug validation and search patterns.
  • Inspect numbered capture groups and match positions.
  • Test global, case-insensitive, multiline, and other JavaScript flags.

JavaScript regular-expression behavior

The tester uses browser JavaScript regex syntax. Patterns from PCRE, Python, .NET, or other engines can use features or escaping rules that behave differently. A worker timeout helps stop patterns that take too long.

Frequently asked questions

Should I include slash delimiters?

No. Enter the pattern itself and select flags separately.

Why does a pattern from another language fail?

Regular-expression engines differ. Convert unsupported syntax to JavaScript-compatible syntax.

Can a regex still be unsafe in production?

Yes. Test adversarial and long inputs because some patterns can cause excessive backtracking.

Related Code & Development Tools