Live match highlighting · Named groups · All flags · Replace mode · Pattern library
| Symbol | Meaning | Example |
|---|---|---|
| . | Any character (except newline) | a.c → "abc","a1c" |
| \d | Digit [0-9] | \d+ → "123" |
| \D | Non-digit | \D+ → "abc" |
| \w | Word char [a-zA-Z0-9_] | \w+ → "hello_1" |
| \W | Non-word char | \W → " ", "!" |
| \s | Whitespace | \s+ → " " |
| \S | Non-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|b | Alternation (or) | cat|dog |
| (?=abc) | Positive lookahead | foo(?=bar) |
| (?!abc) | Negative lookahead | foo(?!bar) |
| (?<=abc) | Positive lookbehind | (?<=foo)bar |
| (?<!abc) | Negative lookbehind | (?<!foo)bar |
| \b | Word boundary | \bword\b |
| *? | 0 or more (lazy) | <.*?> → shortest match |
| +? | 1 or more (lazy) | .+? → single char |