Regex Tester

Test a regular expression against your text, with matches highlighted, groups listed and a replace preview.

100% private, runs in browser Free, no sign-up
//g
Try:

Tested in your browser. Your pattern and text are never sent anywhere.

How to use the regex tester

  1. Type your pattern without the surrounding slashes, and tick the flags you need.
  2. Paste some test text. Matches are highlighted as you type, and capture groups are listed in a table.
  3. Tick "Preview a replace" to see the text after a find-and-replace, using $1 or $<name> for groups.

Quick reference

PatternMatches
\d \w \sA digit; a letter, digit or underscore; a space, tab or line break
.Any character except a line break (with the s flag, line breaks too)
[abc] [^abc]One of a, b or c; any character except those
* + ? {2,4}0 or more; 1 or more; 0 or 1; 2 to 4 of the thing before
^ $ \bStart; end (of each line with the m flag); a word boundary
(…) (?<name>…) (?:…)A numbered group; a named group; a group that isn't captured
a|ba or b

Worked example

Pattern \b\d{4}-\d{2}-\d{2}\b with g Text "sent on 2026-10-13, paid by 2026-11-12" Matches 2026-10-13 (at 8) and 2026-11-12 (at 28) Pattern (\d{4})-(\d{2})-(\d{2}) replace with $3/$2/$1 Result "sent on 13/10/2026, paid by 12/11/2026"

Frequently asked questions

Which regex flavour does this use?

JavaScript's, as built into your browser. Most patterns work the same in Python, Java, PHP and .NET, but some features differ, such as lookbehind support and how named groups are written. Test in your own language before relying on a pattern.

Why did it say "stopped after 1 second"?

Some patterns, especially nested repeats like (a+)+, can take an extremely long time on text that almost matches (called catastrophic backtracking). We run the match in the background and stop it after a second so the page doesn't freeze. The same pattern could slow down a real program, so it's worth rewriting.

Is my text sent anywhere?

No. Matching happens in your browser.

Keep going

Related tools

All Developer tools

Disclaimer: results are estimates for planning only and are not tax, legal or financial advice. Rules and rates vary by country, state and personal situation. Check with a qualified accountant before making decisions. Read the full disclaimer.

Last updated: