Regex Tester

Enter a regex pattern and test string to see all matches highlighted in real time. Supports capture groups, substitution, and all standard JavaScript flags.

Link copied to clipboard
//g
Flags:
Match Results
e.g. (\w+)\s(\d+)

How to use this tool

  1. Type or paste a regular expression into the Pattern field (e.g. \d+ to match numbers).
  2. Enter the text you want to test in the Test String area — matches will be highlighted immediately.
  3. Toggle flags (g, i, m, s) to change how the pattern matches across the text.
  4. Switch to the Substitution tab to enter a replacement string and preview the result live.
  5. Click Copy Share URL to share your regex and test string with others via a direct link.

Why use our Regex Tester?

Regular expressions are one of the most powerful tools in a developer's toolkit, but getting them right can be tricky. Our Regex Tester lets you experiment with patterns in real time, see exactly which characters match, inspect individual capture groups, and preview substitutions — all without leaving the browser. Nothing is sent to a server: your patterns and test data stay private.

Frequently Asked Questions

What does the ^ mean in regex?

The caret ^ anchors the match to the start of the string (or the start of a line when the multiline flag m is enabled). For example, ^Hello matches 'Hello' only when it appears at the very beginning.

How do I match a literal dot?

In regex, an unescaped dot . matches any character. To match a literal dot, escape it with a backslash: \. — for example, \d+\.\d+ matches a decimal number like 3.14.

What is a capture group?

A capture group is a part of a pattern wrapped in parentheses, e.g. (\w+). When the pattern matches, the content matched by each group is extracted separately. Groups are numbered from left to right starting at 1, and you can reference them in substitutions with $1, $2, etc.

What regex flavour does this tool use?

This tester uses the native JavaScript RegExp engine built into your browser. It supports all standard ECMAScript regex features including lookahead, lookbehind (in modern browsers), named groups, and Unicode mode.

What do the flags g, i, m, and s do?

g (global) finds all matches instead of stopping after the first. i (ignore case) makes the match case-insensitive. m (multiline) makes ^ and $ match the start and end of each line. s (dotAll) makes the dot . match newline characters as well.