Regex tester – test regular expressions with live highlighting
Type a regular expression and some test text to see every match highlighted, with capture groups, replace preview and a quick cheat sheet. Uses the JavaScript regex engine, right in your browser.
Regex cheat sheet
.any character\ddigit,\Dnot digit\wletter, digit or _\swhitespace\bword boundary^start,$end[abc]one of a, b, c[^abc]not a, b or ca*0 or more,a+1 or morea?optionala{2,4}2 to 4 times(…)capture group(?<name>…)named group(?:…)non-capturing groupa|ba or b(?=…)lookahead- Flags:
gall,iignore case,mmultiline,sdot matches newline,uunicode
How to test a regular expression
- Type your pattern between the slashes – without the slashes themselves – and add flags such as
g,iorm. - Paste test text. Every match is highlighted as you type.
- Check the details: each match shows its position and capture groups.
- Try a replacement with
$1,$2or$<name>to preview a find-and-replace.
Which regex flavour does this use?
This tester uses your browser’s JavaScript (ECMAScript) engine – the same one used in JavaScript, TypeScript and Node.js. Most simple patterns work the same in Kotlin, Java, Python and PHP, but some features differ: lookbehind, named group syntax and Unicode classes vary between languages. In Kotlin and Java, remember to double every backslash inside normal strings ("\\d+"), or use Kotlin raw strings.
Tips
- Start simple and add parts one by one while watching the highlights.
- Use
^and$with themflag to match whole lines. - Avoid nested quantifiers like
(a+)+– they can be extremely slow on long text. - For real email validation, send a confirmation email – no regex catches every valid address.
Frequently asked questions
What regex engine does this tester use?
The JavaScript engine in your browser, so results match JavaScript, TypeScript and Node.js exactly. Other languages are very similar for common patterns.
How do I match a whole line?
Use ^ at the start and $ at the end of your pattern, and add the m (multiline) flag so they match at every line.
What do the g, i and m flags do?
g finds all matches instead of the first, i ignores upper and lower case, and m makes ^ and $ work on each line.
How do I use capture groups in a replacement?
Wrap parts of the pattern in brackets and use $1, $2 in the replacement. For named groups such as (?<year>…) use $<year>.
Is my text uploaded?
No. Everything runs in your browser.
Need a website or app built?
We design and build websites and Android apps for clients worldwide – clear scope, fixed price, fast delivery.
Techpass Master Technologies · Websites, Android apps and digital marketing
