Regular Expression
Test Text
File Scanner
Substitution
Matches
Replacement Result
Regex Cheat Sheet
| Token | Description |
|---|---|
. | Any char except newline |
\d, \w, \s | Digit, Word, Whitespace |
\D, \W, \S | Not Digit, Word, Whitespace |
[abc] | Any of a, b, or c |
[^abc] | Not a, b, or c |
[a-z] | Chars a through z |
a|b | a or b |
^, $ | Start/End of string (or line with m) |
\b, \B | Word boundary, Not word boundary |
*, +, ? | 0+, 1+, 0 or 1 repetition |
{n}, {n,}, {n,m} | Exactly n, n or more, between n and m |
(...) | Capture Group |
(?:...) | Non-capturing group |
(?=...) | Positive lookahead |
(?!...) | Negative lookahead |