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.
| Pattern | Matches | Example |
|---|---|---|
\d+ | One or more digits | Order 66 shipped on day 12 -> 66, 12 |
\b\w+@\w+\.\w+\b | Simple email address | mail ann@example.com now -> ann@example.com |
^\s+|\s+$ | Spaces at the start or end of a line | Use with the g flag to find the trim spots |
(\d{4})-(\d{2})-(\d{2}) | ISO date with three groups | 2026-10-20 -> groups 2026, 10, 20 |
#[0-9a-fA-F]{6}\b | Hex colour code | Paint it #ff8800 -> #ff8800 |
(?<year>\d{4}) | Named group | Shows up as groups.year in the list |
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.
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.
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.
No. The pattern runs in your browser and nothing is sent anywhere.
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