Regex Tester Pro

Live match highlighting · Named groups · All flags · Replace mode · Pattern library

Regular Expression
/ /g
Highlighted Text
Type a regex and test string above…
Replace Mode
Common Patterns — click to use
Quick Reference
SymbolMeaningExample
.Any character (except newline)a.c → "abc","a1c"
\dDigit [0-9]\d+ → "123"
\DNon-digit\D+ → "abc"
\wWord char [a-zA-Z0-9_]\w+ → "hello_1"
\WNon-word char\W → " ", "!"
\sWhitespace\s+ → " "
\SNon-whitespace\S+ → "hello"
^Start of string/line (m flag)^Hello → matches at line start
$End of string/line (m flag)world$ → matches at line end
*0 or more (greedy)ab* → "a","ab","abb"
+1 or more (greedy)ab+ → "ab","abb"
?0 or 1 (optional)colou?r → "color","colour"
{n}Exactly n times\d{3} → "123"
{n,m}Between n and m times\d{2,4} → "12","1234"
[abc]Character class[aeiou] → vowels
[^abc]Negated character class[^0-9] → non-digit
(abc)Capturing group(ab)+ → "ab","abab"
(?:abc)Non-capturing group(?:ab)+ → no capture
(?<name>)Named capturing group(?<yr>\d{4})
a|bAlternation (or)cat|dog
(?=abc)Positive lookaheadfoo(?=bar)
(?!abc)Negative lookaheadfoo(?!bar)
(?<=abc)Positive lookbehind(?<=foo)bar
(?<!abc)Negative lookbehind(?<!foo)bar
\bWord boundary\bword\b
*?0 or more (lazy)<.*?> → shortest match
+?1 or more (lazy).+? → single char