Developer tool

Regex Tester

Test JavaScript regular expressions against sample text with live highlights, match indexes, and captured groups.

Test JavaScript regular expressions

Regular expressions are powerful, but small changes can produce surprising matches. This tester lets you enter a pattern, choose flags, paste sample text, and immediately see highlighted matches, indexes, and captured groups.

The page uses the browser's RegExp implementation. Add flags such as g, i, m, s, u, or y to match the behavior you expect in JavaScript code.

Useful regex checks

  • Test a validation pattern before adding it to a form.
  • Check capture groups for parsing logs, filenames, or IDs.
  • Compare case-sensitive and case-insensitive matches with the i flag.

FAQ

Which regex engine is used?

The tester uses the JavaScript RegExp implementation in your browser.

Why is the g flag added?

Global matching is needed to list every match. If you omit g, the tool adds it for testing while preserving your other flags.

Can this test PCRE or Python regex?

No. Syntax and features can differ between regex engines, so this page is best for JavaScript patterns.