Regex Tester

Loading the tool…

Check a regular expression before you put it in your code. Paste some text, type a pattern and see every match with its position and capture groups, including named groups. Switch on Replace to preview the text with each match replaced, using $1 or $<name> references. The syntax is the one used by JavaScript and Dart.

Tip: matches update as you type. Press Ctrl + Enter (Cmd + Enter on a Mac) to test very large texts.

How to use the Regex Tester

  1. Type your regular expression in the Pattern box, without the surrounding slashes.
  2. Paste or type the text to test it against. The matches update as you type.
  3. Turn on Ignore case, Multiline, Dot matches newline or Unicode if your pattern needs those flags.
  4. Optionally turn on Replace and enter the replacement to preview the result, then copy it.

How matches are shown

All matches
The pattern is applied to the whole text, like the g flag in JavaScript. Each match shows its line, column and character index, so you can find it in your file.
Groups
Every capture group is listed by number, and named groups such as (?<year>\d{4}) are also listed by name. A group that took no part in the match is shown as (not matched).
Visible whitespace
Line breaks and tabs inside a match are shown as \n and \t, so you can see exactly what was matched.
Replacement
In Replace mode, $& inserts the whole match, $1 to $99 insert numbered groups, $<name> inserts a named group and $$ inserts a dollar sign.
Syntax
Patterns use ECMAScript (JavaScript) syntax, which Dart, Flutter, JavaScript and TypeScript share. Most patterns also work in Java, C# and Python, but look-behind and some escapes differ.

Examples

These outputs were produced by the same code that runs in the Tool tab.

Find order codes and capture the number

One capture group pulls out the numeric part of each code.

Text

Order ZV-1001 shipped on 2026-11-04.
Order ZV-1002 is waiting for stock.
Refund for zv-0999 approved.

Matches

Match 1 · line 1, column 7 · index 6–13
  "ZV-1001"
  Group 1: "1001"

Match 2 · line 2, column 7 · index 43–50
  "ZV-1002"
  Group 1: "1002"

Dates with named groups

Named groups make the parts of a date easy to read.

Text

Invoice 2026-11-04, due 2026-12-04.

Matches

Match 1 · line 1, column 9 · index 8–18
  "2026-11-04"
  Group 1: "2026"
  Group 2: "11"
  Group 3: "04"
  <year>: "2026"
  <month>: "11"
  <day>: "04"

Match 2 · line 1, column 25 · index 24–34
  "2026-12-04"
  Group 1: "2026"
  Group 2: "12"
  Group 3: "04"
  <year>: "2026"
  <month>: "12"
  <day>: "04"

Reformat dates with a replacement

Turn ISO dates into day/month/year with group references.

Text

Invoice 2026-11-04, due 2026-12-04.

Matches

Invoice 04/11/2026, due 04/12/2026.
  • Use $& for the whole match, $1 … $99 for groups, $<name> for named groups and $$ for a dollar sign.

Lines that start with a word, ignoring case

Multiline makes ^ match at the start of every line.

Text

ERROR disk full
warning low memory
Error timeout
INFO started

Matches

Match 1 · line 1, column 1 · index 0–15
  "ERROR disk full"

Match 2 · line 3, column 1 · index 35–48
  "Error timeout"

Frequently asked questions

Do I type the slashes around the pattern?

No. Type only the pattern, for example \d+ rather than /\d+/g. Flags are set with the switches next to the Pattern box.

Why does my pattern match nothing?

Check the case of letters (or turn on Ignore case), and remember that ^ and $ match only at the start and end of the whole text unless Multiline is on. Special characters such as . ( ) [ ] + ? * need a backslash to match literally.

Will my pattern work the same in Python, Java or PHP?

Basic patterns behave the same. Differences appear in look-behind, named group syntax (Python also accepts (?P<name>…)), possessive quantifiers and some escapes, so test in your target language for anything advanced.

Is my text uploaded?

No. The pattern and text are processed on your device.

Limitations and edge cases

  • Up to 500 matches are listed; the total count is always shown.
  • A pattern with catastrophic backtracking, such as (a+)+$ on a long string, can make the page slow to respond. Very large texts are tested only when you press Test.
  • Look-behind and named groups need a current browser; very old browsers may report them as invalid.

Read the privacy policy for how the site handles data.