Regex Tester (JavaScript Regular Expressions)

Matches-

Highlighted text

Match list

How to use the regex tester

Type a pattern without the surrounding slashes, tick the flags you need and paste some text. Every match is highlighted as you type, and the list below shows each match with its position and its capture groups (numbered groups, and named groups written as (?<name>...)). This tester uses the JavaScript regular expression engine built into your browser, so the behaviour is exactly what you get in JavaScript, TypeScript and Node.js. Other languages (Python, PHP, Java, .NET) are very close for everyday patterns but differ in details such as named group syntax and lookbehind support.

Handy patterns to try

PatternMatchesExample
\d+One or more digitsOrder 66 shipped on day 12 -> 66, 12
\b\w+@\w+\.\w+\bSimple email addressmail ann@example.com now -> ann@example.com
^\s+|\s+$Spaces at the start or end of a lineUse with the g flag to find the trim spots
(\d{4})-(\d{2})-(\d{2})ISO date with three groups2026-10-20 -> groups 2026, 10, 20
#[0-9a-fA-F]{6}\bHex colour codePaint it #ff8800 -> #ff8800
(?<year>\d{4})Named groupShows up as groups.year in the list

FAQ

What do the flags mean?

g finds all matches instead of only the first. i ignores upper/lower case. m makes ^ and $ match at every line break. s lets the dot match line breaks. u turns on full Unicode matching.

Why do I get no matches?

Check that the g flag is set if you expect several matches, escape special characters such as . ( ) [ ] with a backslash, and remember patterns are case sensitive unless you tick i.

What are capture groups?

Parentheses create a group that remembers the part of the text it matched. The match list shows group 1, 2, 3 and so on. Use (?:...) for a group you do not want to capture, and (?<name>...) to give a group a name.

Is my text uploaded?

No. The pattern runs in your browser and nothing is sent anywhere.

Why did the page stop responding?

Some patterns, such as nested repeats like (a+)+ on long text, can take extremely long to evaluate (catastrophic backtracking). Simplify the pattern or shorten the test text. Matches are capped at 1,000 to keep the page responsive.

JavaScript (ECMAScript) regular expression syntax. Other regex flavours may differ slightly.

See also: text diff checker · JSON formatter · word counter · remove duplicate lines · URL encoder · Markdown preview · all tools