Developer Tools 79 ACTIVE USERS

Regex Tester

Write a JavaScript regular expression, set its flags and paste test text to see every match listed live as you type, with syntax errors shown immediately.

Released March 2026 Stable

App Interface

What a regex tester is for

A regular expression, or regex, is a compact pattern that describes text: an email address, a date, a product code, a log line. Regexes are used in form validation, search and replace in editors, data cleaning, log analysis and routing rules. They are also easy to get subtly wrong, so it pays to try a pattern against real examples before putting it in code. This tester lets you do that in the browser, using the same JavaScript regex engine your web pages and Node.js scripts use.

Everything runs locally. Your pattern and text are not sent to the server.

How to use it

  1. Type your pattern into Regex Pattern without surrounding slashes, for example \d{4}-\d{2}-\d{2}.
  2. Enter flags in the Flags box. It starts with g, and you should keep it: the tool lists all matches, which requires the global flag. Add i for case-insensitive matching or m for multi-line anchors, for example gi.
  3. Paste sample text into Test String.
  4. The Matches box lists every full match, one per line, and updates as you edit either field.
  5. If the pattern or flags are invalid, a red message shows the browser's error, such as an unterminated group.

Worked examples

Find ISO dates

Pattern \d{4}-\d{2}-\d{2}, flags g, text Due 2026-11-02, paid 2026-10-28, ref 12026-1-1. Matches:

  • 2026-11-02
  • 2026-10-28

The reference number is not matched because its month and day have one digit.

Pull email addresses from text

Pattern [\w.+-]+@[\w-]+\.[A-Za-z]{2,}, flags g, text Contact sara@example.com or ops@test.org. Not: bob@localhost. Matches sara@example.com and ops@test.org; bob@localhost is skipped because it has no dot and domain ending. Ending the pattern with letters only stops the sentence's full stop from being included.

Flags and limits

FlagMeaning
gGlobal: find all matches. Required by this tool.
iIgnore case
mMulti-line: ^ and $ match at each line break
sDot-all: . also matches newlines
uUnicode mode, for code points and property escapes like \p{L}
  • Without g, the browser refuses to list all matches and the tool shows an error.
  • Only the whole match is shown. Capture groups are not broken out separately, and there is no replace preview.
  • The syntax is JavaScript's. Most patterns carry over to Python, PHP (PCRE) and Java, but features like possessive quantifiers or inline modifiers differ between engines.

Tips and common mistakes

  • Escape special characters. A literal dot is \.; an unescaped . matches any character, so example.com also matches exampleXcom.
  • Greedy quantifiers grab too much. <.+> on <b>hi</b> matches the whole string. Use the lazy <.+?> to stop at the first closing bracket.
  • Anchor validation patterns. When checking that a whole input is valid, wrap the pattern in ^ and $, otherwise a match anywhere inside counts.
  • Do not double-escape here. In source code strings you often write \\d; in this tester write the regex itself, \d.
  • Empty lines in the results mean your pattern can match zero characters, for example \d*. Use + instead of * if you want at least one character.

Related concepts

Character classes such as \d, \w and \s match digits, word characters and whitespace. Word boundaries (\b) match the position between a word character and a non-word character, useful for matching whole words. Lookaheads like (?=...) check what follows without consuming it, which is how password-rule regexes test for a digit and a capital letter in one pattern.

Building a pattern step by step

The quickest way to write a reliable regex is to paste a handful of real examples, including ones that should not match, into the test string, then grow the pattern a piece at a time. Start with the part you are sure of, confirm it matches, add the next piece, and watch the Matches list after each change. When an unexpected match appears, you know the last edit caused it.

Frequently Asked Questions

Which regex flavour does this tester use?

JavaScript's built-in RegExp engine, the same one used in browsers and Node.js.

Why do I get an error when I remove the g flag?

The tool lists every match using matchAll, which only works with a global regular expression. Keep g in the flags box and add others alongside it.

Can I see capture groups?

No. The tool lists the full text of each match, one per line. Capture groups are not shown separately.

Should I type the slashes around my pattern?

No. Enter only the pattern, and put flags in the separate Flags box.

Is my test text sent to a server?

No. Matching happens in your browser.

Share this Tool

Help others discover this professional utility engine.