[ advertisement ]

Regular Expression Tester

Write a pattern, toggle flags and instantly see highlighted matches, every captured group and the result of replacements, using the JavaScript regex engine.

Regular expression

//g

Test text

Highlight · 0 match(es)

Contacts: jane@example.com, john.smith+dev@company.co.uk
Invalid: user@localhost

Captured groups

Replace

Use via API

Arbitrary regular expressions can cause catastrophic backtracking (ReDoS) and hang the server. In the browser, the tool isolates each run in a Web Worker with a timeout; that isolation does not exist in the API runtime.

[ advertisement ]

How to use

  1. Type the pattern without the delimiting slashes.
  2. Enable the flags you need (g, i, m, s, u, y).
  3. Paste the test text and see the highlighted matches.
  4. Inspect the numbered and named groups of each match.
  5. Try replacements with $1, $<name> and $&.

Use cases

  • Validating formats such as email, phone numbers and postal codes before using them in forms.
  • Extracting data from logs and text files.
  • Building search-and-replace patterns for bulk refactors in your editor.
  • Debugging regexes that fail in production.

Technical concepts

Flags

g finds every match, i ignores case, m makes ^ and $ work per line, s makes the dot match line breaks, u enables full Unicode mode (needed for \p{L}) and y requires a match exactly at the current position.

Capture groups

Parentheses create numbered groups; (?<name>...) creates named groups, available as $<name> in replacements. Use (?:...) to group without capturing, which makes the pattern faster and the numbering cleaner.

Catastrophic backtracking

Nested quantifiers such as (a+)+ can make the engine try an exponential number of paths and freeze the application (ReDoS). This tool runs the regex in a Web Worker with a 1-second limit, stopping problematic patterns without freezing the page.

Frequently asked questions

Which regex flavor is used?

Your browser's ECMAScript engine. The syntax is very close to PCRE, but features such as variable-length lookbehind and atomic groups may differ from other languages.

Why is only one match shown?

Without the g flag, only the first match is returned. Enable g to list them all.

Is there a match limit?

Up to 1,000 matches are shown to keep the interface responsive; the counter indicates when there are more.

Related tools