Regex tester
JavaScript regular expressions, tested live in your browser. Nothing is sent.
//
Matches
Capture groups
Replace
Cheat sheet
. | any character (not newline unless s) | \d \w \s | digit, word char, whitespace (capital = opposite) |
^ $ | start / end of input (line with m) | \b | word boundary |
[abc] [^abc] | one of / none of | [a-z] | range |
* + ? | 0+, 1+, 0 or 1 (add ? for lazy) | {2,4} | between 2 and 4 times |
(x) | capture group | (?:x) | non-capturing group |
(?<n>x) | named group | a|b | a or b |
(?=x) (?!x) | lookahead, negative | (?<=x) (?<!x) | lookbehind, negative |
\1 \k<n> | backreference | \. \\ \/ | escape a special character |