Skip to the tool

Regex tester

Type a pattern and watch it match live: highlighted text, capture groups spelled out, a replace preview and a shareable link that never touches a server.

Guide

How to use it

  1. Type the pattern without surrounding slashes; toggle flags beneath it (hover each for what it does).
  2. Paste test text. Matches highlight as you type, and the list shows each match with its groups.
  3. Add a replacement with $1-style references to preview a rewrite, then copy the result.
  4. Copy shareable link packs pattern, flags and text into the URL fragment for a colleague.
  5. Blank on syntax? The cheat sheet and common patterns pages feed straight into this tester.

Examples

Worked examples

Pull emails from a page

The preloaded pattern grabs the two real addresses in the sample and correctly skips sam@localhost, no dot in the domain.

Swap date parts

Pattern (\d\d)/(\d\d)/(\d{4}), replacement $3-$2-$1: UK dates become ISO dates across a whole file in the replace preview.

Find double words

\b(\w+)\s+\1\b with the i flag catches "the the" and "is is", the classic proofreading slip that eyes skate over.

Method

How it works

Your pattern is compiled by the browser's own JavaScript regex engine, so what matches here matches in your code. Matches are found with exec in a loop (capped at 2,000, with zero-length matches stepped over rather than spinning), highlighted in place and listed with their numbered groups. The replace preview is a straight String.replace with your pattern and replacement.

Shared links keep everything in the URL fragment, which browsers never transmit, so even the sharing is private.

FAQ

Frequently asked questions

Which regex flavour does this use?

JavaScript's, the flavour of the browser you are in. It is close to PCRE for everyday patterns; the differences show in exotic features like lookbehind support and possessive quantifiers.

What do the flags mean?

g finds all matches instead of the first, i ignores case, m makes ^ and $ work per line, s lets the dot match newlines and u enables full unicode handling. Hover each flag for a reminder.

Why does my pattern match too much?

Usually a greedy quantifier: .* grabs as much as possible. Add ? for the lazy version (.*?) or, better, match what you mean, like [^"]* for everything up to a quote.

How do capture groups work in replace?

Parentheses capture parts of each match; $1, $2 and so on reinsert them in the replacement. Swapping day and month in dates is the classic use.

Is my test text sent anywhere?

No, matching runs in your browser. Even the share link keeps everything in the URL fragment, the part after #, which browsers never send to any server.

Why does an empty match show a caret mark?

Patterns like a* can match zero characters at a position. The tester marks the spot rather than looping forever, which is a hint the pattern needs anchoring.

More tools

Related tools

Regex cheat sheetEvery everyday token, with the tester on the same page. Common regex patternsEmail, UK postcode, URL, IPv4 and dates, ready to load. Diff checkerCompare the text before and after your replace. JSON formatterInspect the data your pattern is extracting from.
Skip to the tool

Regex tester

Type a pattern and watch it match live: highlighted text, capture groups spelled out, a replace preview and a shareable link that never touches a server.

2 matches.

Reach us at hello@woldscyber.co.uk or sales@example.com. Not an address: sam@localhost, @handle.

Matches and groups

#1 at 12 hello@woldscyber.co.uk
#2 at 38 sales@example.com
The link stores pattern, flags and text in the URL fragment, which never reaches any server.

Everything runs in your browser using the JavaScript regex engine. Nothing you test is sent anywhere.

Guide

How to use it

  1. Type the pattern without surrounding slashes; toggle flags beneath it (hover each for what it does).
  2. Paste test text. Matches highlight as you type, and the list shows each match with its groups.
  3. Add a replacement with $1-style references to preview a rewrite, then copy the result.
  4. Copy shareable link packs pattern, flags and text into the URL fragment for a colleague.
  5. Blank on syntax? The cheat sheet and common patterns pages feed straight into this tester.

Examples

Worked examples

Pull emails from a page

The preloaded pattern grabs the two real addresses in the sample and correctly skips sam@localhost, no dot in the domain.

Swap date parts

Pattern (\d\d)/(\d\d)/(\d{4}), replacement $3-$2-$1: UK dates become ISO dates across a whole file in the replace preview.

Find double words

\b(\w+)\s+\1\b with the i flag catches "the the" and "is is", the classic proofreading slip that eyes skate over.

Method

How it works

Your pattern is compiled by the browser's own JavaScript regex engine, so what matches here matches in your code. Matches are found with exec in a loop (capped at 2,000, with zero-length matches stepped over rather than spinning), highlighted in place and listed with their numbered groups. The replace preview is a straight String.replace with your pattern and replacement.

Shared links keep everything in the URL fragment, which browsers never transmit, so even the sharing is private.

FAQ

Frequently asked questions

Which regex flavour does this use?

JavaScript's, the flavour of the browser you are in. It is close to PCRE for everyday patterns; the differences show in exotic features like lookbehind support and possessive quantifiers.

What do the flags mean?

g finds all matches instead of the first, i ignores case, m makes ^ and $ work per line, s lets the dot match newlines and u enables full unicode handling. Hover each flag for a reminder.

Why does my pattern match too much?

Usually a greedy quantifier: .* grabs as much as possible. Add ? for the lazy version (.*?) or, better, match what you mean, like [^"]* for everything up to a quote.

How do capture groups work in replace?

Parentheses capture parts of each match; $1, $2 and so on reinsert them in the replacement. Swapping day and month in dates is the classic use.

Is my test text sent anywhere?

No, matching runs in your browser. Even the share link keeps everything in the URL fragment, the part after #, which browsers never send to any server.

Why does an empty match show a caret mark?

Patterns like a* can match zero characters at a position. The tester marks the spot rather than looping forever, which is a hint the pattern needs anchoring.

More tools

Related tools