Test regular expressions in real time. Highlights all matches, shows capture groups, and previews find-and-replace output — all in your browser.
All processing happens in your browser
Enter a pattern and test string to see matches
A regular expression (regex) is a sequence of characters that defines a search pattern. Used for string matching, validation, extraction, and replacement, regex is built into virtually every programming language and text editor.
This tool uses JavaScript's built-in RegExp engine, which supports the ECMAScript regex specification including lookaheads, lookbehinds, named capture groups, and Unicode property escapes.
| Flag | Effect | Example |
|---|---|---|
| g | Global — find all matches, not just the first | /a/g matches every "a" |
| i | Case-insensitive — ignore letter case | /hello/i matches "Hello" |
| m | Multiline — ^ and $ match line boundaries | /^foo/m matches at start of each line |
| s | DotAll — . matches newlines | /a.b/s matches "a\nb" |
Parentheses (...) create capture groups that extract part of a match. Numbered groups are referenced as $1, $2, etc. in replacement strings. Named groups use the syntax (?<name>...) and are referenced as $<name>.
For example, (\d4)-(\d2)-(\d2) matches a date like 2024-03-15. Using $3/$2/$1 as the replacement string reformats it to 15/03/2024.
| Matches | Pattern | Example |
|---|---|---|
| [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,} | [email protected] | |
| IPv4 | \b(?:\d{1,3}\.){3}\d{1,3}\b | 192.168.1.1 |
| Digits | \d+ | 42 |
| Whitespace | \s+ | spaces and tabs |
| URL | https?://[\w.-]+ | https://example.com |
DMC IT Services builds and manages data processing infrastructure for SMBs across London, Cambridge, Hertfordshire, and Bedfordshire — from log aggregation and text extraction pipelines to automated monitoring and alerting.
Talk to an Engineer