Text Tools

Regex Tester

Test regular expressions with live matching and highlights.

What this JavaScript regex tester does

This tester compiles the pattern and flags with the browser's JavaScript RegExp engine, applies it to the supplied text, highlights each match, and reports its starting index and capture groups. Enter the pattern source without surrounding slash delimiters. Add g to collect every match; without it, JavaScript returns only the first match. Use the match count and indices to confirm repeated matches occur where expected.

Loading tool...

Common use cases

  • Prototype validation rules for identifiers, dates, log lines, or other constrained text.
  • Extract repeated values such as email-like strings, ticket numbers, or named fields.
  • Compare case-sensitive and case-insensitive behavior with i, or line anchors with m.
  • Inspect capturing groups before moving a pattern into JavaScript or TypeScript code.

Worked example

Pattern: \b([A-Za-z0-9._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,})\b. Flags: gi. Test text: "Contact Ada at ada@example.com or SUPPORT@EXAMPLE.ORG." The result is two highlighted matches. Capture group 1 contains each local part, while group 2 contains each domain. The g flag continues after the first match, and i makes letter case irrelevant.

Limitations and privacy

This tool follows ECMAScript regular-expression syntax available in the current browser; PCRE, Python, .NET, and Java-specific constructs may fail or behave differently. A successful match proves only that the pattern matched, not that an email, URL, date, or other value is semantically valid. Ambiguous nested quantifiers can cause expensive backtracking on long input. Pattern evaluation and test text stay in the browser; still avoid sensitive production data on shared devices.

Related developer tools

Continue with Regex Escape, Text Diff, Case Converter.

How to Use Regex Tester

  1. Enter or paste your input in the text area above
  2. The tool will process your input automatically or click the action button
  3. Copy the result using the copy button

Frequently Asked Questions

What is regex?

Regular expressions (regex) are patterns used to match character combinations in strings. They are used for searching, replacing, and validating text.

Which regex flavor is supported?

This tester uses the JavaScript RegExp engine and supports ECMAScript syntax and flags available in your browser. Invalid patterns are reported as syntax errors.

Which regex flags can I test?

You can test the standard JavaScript flags supported by your browser, including global, case-insensitive, multiline, dotAll, Unicode, and sticky matching.

Sources & references

Primary references: ECMAScript specification: RegExp objects.

Last reviewed: