Regex Tester

text / regex
Pattern
//g
Test string
Replace with
Cheat sheet
.Any character except a newline
\d \DA digit; anything that is not a digit
\w \WA word character (letter, digit, underscore); the inverse
\s \SWhitespace; anything that is not whitespace
[abc]Any one of a, b or c
[^abc]Any character except a, b or c
[a-z]Any character in the range a to z
^ $Start and end of the input, or of a line with the m flag
\bA word boundary
* + ?Zero or more, one or more, zero or one
{n} {n,} {n,m}Exactly n, at least n, between n and m
*? +?The lazy forms: match as few characters as possible
(abc)A capture group, retrievable by number
(?<name>abc)A named capture group
(?:abc)A group that does not capture
a|bEither a or b
(?=abc)Lookahead: followed by abc, which is not consumed
(?!abc)Negative lookahead: not followed by abc
(?<=abc)Lookbehind: preceded by abc
\. \\A literal dot; a literal backslash