Regex Tester

Test JavaScript regex matches, preview replacements and check reusable cases in a timed worker.

On-device No sign-up Free to use

Test pattern controls

Showing an example. Edit to see your own.

?

JavaScript replacement tokens: $& for the match, $1 for a capture, $<name> for a named capture, $$ for a dollar sign.

?

Up to 20 lines: true or false, then a tab, then sample text. True means the pattern should match. Downloaded JSON keeps your pattern, flags and cases.

?

JavaScript pattern, written without the surrounding slashes.

?

The pattern is tested against this text only, in this browser.

?

With global off, the result shows the first match only.

?

With ignore case on, Cat and cat both match.

?

Without it, ^ and $ mean the start and end of the whole text.

?

With this on, a dot also matches the line break between two lines.

?

Enables Unicode property escapes such as \p{L} and treats a surrogate pair as one code point. An emoji sequence can still contain several code points.

Processed in your browser. Your inputs stay on this device.

Result

Showing an example.

Find three email-like strings and inspect the first match's capture groups.

Three matches: [email protected] at line 1, column 9; [email protected] at line 1, column 28; [email protected] at line 2, column 24. The first match has capture groups ada, example and com.

Loading the tool. Your result will appear here.

https://usefreetools.net/regex-tester · 20 November 2026

Was this helpful?

How to use Regex Tester

  1. Enter a JavaScript pattern without the surrounding slashes.
  2. Paste the sample text and choose the flags you need.
  3. The match report updates as you edit the pattern, flags or text. Read match positions and capture groups before using the expression elsewhere.
  4. Enable replacement preview to test JavaScript replacement tokens. Add optional tab-separated expected-match cases, then review each result.

Example: Regex Tester

Find three email-like strings and inspect the first match's capture groups.

You add
Pattern: (\w+)@(\w+)\.(\w+); Test text: Contact ada@example.com or grace@site.org. The support address is help@example.com.; Global: find every match: true; Ignore case: true; Multiline: ^ and $ match each line: false; Dot matches newlines: false; Unicode mode: false
You get
Three matches: ada@example.com at line 1, column 9; grace@site.org at line 1, column 28; help@example.com at line 2, column 24. The first match has capture groups ada, example and com.

Options

Pattern
JavaScript pattern, written without the surrounding slashes.
Test text
The pattern is tested against this text only, in this browser.
Global: find every match
With global off, the result shows the first match only.
Ignore case
With ignore case on, Cat and cat both match.
Multiline: ^ and $ match each line
Without it, ^ and $ mean the start and end of the whole text.
Dot matches newlines
With this on, a dot also matches the line break between two lines.
Unicode mode
Enables Unicode property escapes such as \p{L} and treats a surrogate pair as one code point. An emoji sequence can still contain several code points.
Replacement preview
Supports JavaScript substitution tokens including $&, numbered captures, named captures and $$. Replacement also runs in the time-limited worker.
Reusable test cases
Up to 20 lines: true or false, a tab, then sample text. Download a JSON record of the current pattern, flags, sample and cases.
Match and group preview
Matches are marked in the sample text. Capture values for up to the first 100 matches appear beneath it.

Supported inputs and limits

  • Uses the browser's JavaScript regular-expression flavor, not PCRE or Python syntax.
  • The pattern is capped at 200 characters, sample text at 100,000 characters and displayed matches at 2,000.
  • A background worker is stopped after 1.5 seconds; timing depends on the visitor's device.
  • Email-like matches are not email-address validation.
  • Word and number example buttons fill editable fields.
More details

Replacement preview, inline highlighted matches and a complete token explainer are not provided.

Replacement text is capped at 10,000 characters, with at most 2,000 replacements and 200,000 output characters.

Patterns use the JavaScript flavor only.

Where your input is processed

This tool does not upload your inputs. See the limits for anything saved on your device.

Questions about Regex Tester

Why did a pattern work in another regex tool but fail here?

Regex flavors differ. This page uses JavaScript syntax and the selected JavaScript flags; PCRE-specific features may not compile.

Why did the pattern stop before showing matches?

Some patterns take too long on particular text. The background worker is stopped after the time limit so the page stays usable.

What does Global change?

Global asks for successive matches. With it off, the page reports the first match only.

Are match positions byte offsets?

No. Positions follow JavaScript text indexing, which counts UTF-16 code units. A character outside the basic multilingual plane may use two units.

Page updated · Project managed by Tony Hines · Report a problem with Regex Tester