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.
Leave this blank to remove each match. Refer to groups with $1 or $<name>.
Matches
Enter a regular expression to see matches.
Match details and capture groups
How to use this tool
- Enter a pattern in Regular expression, then paste text into Sample text.
- 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.
- Enter Replacement text to preview the result.
$&represents the full match,$1the 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.