Regex Tester

Test JavaScript regular expressions. Enter a pattern and sample text to see matches, capture groups, and replacement output.

Used … times.

Test input

Loading an example replaces the pattern, sample text, and replacement text.

Enter the pattern only. Do not include the surrounding / delimiters.

Flags

Use g to find every match and i to ignore letter case.

Leave this blank to remove each match. Refer to groups with $1 or $<name>.

Matches

Enter a regular expression to see matches.

How to use this tool

  1. Enter a pattern in Regular expression, then paste text into Sample text.
  2. Matches are highlighted. Open Match details and capture groups to see each match, its position, and captured values. Positions are zero-based UTF-16 offsets; the end position is exclusive.
  3. Enter Replacement text to preview the result. $& represents the full match, $1 the first group, and $$ a literal dollar sign.
What do the flags mean?
g
Find every match. When off, only the first match is used.
i
Ignore the difference between uppercase and lowercase letters.
m
Make ^ and $ match the start and end of each line.
s
Let . match line breaks.
u
Use Unicode mode, which treats characters such as emoji as code points.
v
Use Unicode set intersections and differences. This flag requires a supported browser and cannot be combined with u.
y
Match only at the current position. With g, each search starts immediately after the previous match and does not skip ahead.

Your input is processed in your browser and is not sent to the site. Sample text is limited to 20,000 UTF-16 code units; the pattern and replacement text are limited to 1,000 each. Details are shown for the first 100 matches.

Please also review the Terms of Service for this web app.

Found a bug or have feedback? Let us know here.

Report bugs, display issues, usability problems, or suggestions for improvement.
Consent
– This form is for bug reports only. In principle, we do not respond to individual submissions.
– If a submission contains defamatory, threatening, or otherwise inappropriate content, we may take appropriate action based on logs such as IP addresses.