Skip to main content

Regex Tester

Test a JavaScript regular expression against your text: see every match highlighted, capture groups, named groups, and a replace preview.

Pattern

Flags
Use $1, $2 or $<name> to insert groups.

Matches

Matches appear here.

Runs in your browser; nothing you enter leaves this page.

How it works

Matching

Type a pattern and toggle flags: g finds every match, i ignores case, m lets ^ and $ match at each line, s lets the dot match a newline, u turns on Unicode mode and y matches only at the exact position. The text is searched with the browser’s own RegExp engine, so the result is what JavaScript code would give you.

Matches are marked in the text and listed with their position and each capture group. Named groups written as (?<name>...) are returned as well, and a group that did not take part shows as unmatched.

Replacing

Type a replacement to preview the whole text after replacing. In it $1, $2 insert capture groups, $<name> a named group, $& the whole match and $$ a dollar sign, exactly as in String.replace.

Limits

Only the first 1,000 matches are collected, and the list shows the first 100. An empty match, such as from x*, is counted but not highlighted; the search moves on by one character so it cannot loop forever.

More tools

All 238 tools