Regex tester

Check matches, capture groups and replacement results of JavaScript regular expressions inside this browser.

Pattern and flags

Enter only the pattern, without surrounding slashes (/).

Flags

Test string

Replacement preview

Use $1 or $<name> to insert capture group values. Up to 1,000 characters are processed.

Results

Results appear once you enter a pattern.

How to use the regex tester

Use it to see where a pattern matches with this browser's JavaScript regular expression engine (RegExp), what the capture groups contain, and how a replacement changes the text.

  1. Enter a pattern and choose the flags you need.
  2. Paste a test string; the results refresh automatically right after you stop typing.
  3. Review the matches and highlight, then add a replacement string and copy the result.

Example: (?<year>\d{4})-(?<month>\d{2}) $<month>/$<year>

Limits

Frequently asked questions

Is my input sent to a server?

No. Everything runs inside this browser, and your input is neither saved nor uploaded. It disappears when you reload.

What should I do when I see “Timed out”?

Nested repetition such as (a+)+$ can make the amount of work explode with only slightly longer input (catastrophic backtracking). Simplify the repetition or shorten the test string.

Is it the same as regular expressions in other languages?

No. This tool follows JavaScript syntax. Python, PCRE and others may support different features and escape rules.

What are $1 and $<name>?

In the replacement string, $1 becomes the value of the first capture group and $<name> becomes the value of the named capture group.