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.

Best for

  • Validation rules before they move into a form or script.
  • Parsing logs, filenames, IDs, and short text patterns.
  • Documented regex examples that need visible matches and capture groups.

Regex testing examples

  • Test \\b\\w+@\\w+\\.com\\b against sample text before using it in a form.
  • Use capture groups to inspect parts of an order ID, filename, or log line.
  • Toggle the i flag to compare case-sensitive and case-insensitive matches.

Related text and data tools

Use the JSON Formatter when your pattern checks JSON logs, the URL Encoder Decoder for encoded query values, and the Case Converter when matched text needs a different naming style.

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.

Does it show capture groups?

Yes. When the pattern contains groups, the match output lists captured values for inspection.

Can I test multiline regex?

Yes. Use the multiline flag when you want anchors such as ^ and $ to work per line.