Regex Cheatsheet
6 toolsCommon regex patterns and what they mean.
Runs in your browser — your files and text stay on your device
A quick reference of common regex patterns and what each one means, covering character classes, quantifiers, anchors and groups. Use it to look up syntax while you build a pattern. Flavors differ slightly between languages, so confirm in your target environment.
\dAny digit (0-9)\DAny non-digit\wAny word character (letters, digits, underscore)\WAny non-word character\sAny whitespace character\SAny non-whitespace character^Start of string/line$End of string/line.Any character except newline.*Zero or more of any character.+One or more of any character?Zero or one of the preceding token[a-z]Any lowercase letter a through z[^a-z]Any character that is NOT a-z(?:...)Non-capturing group(...)Capturing group\bWord boundary\BNot a word boundary{n,m}Between n and m repetitions{n,}n or more repetitionsa|bMatches a or b\b\w+@\w+\.\w+\bSimple email patternhttps?:\/\/\S+URL pattern (http or https)^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$IPv4 address patternFrequently asked questions
What is a regular expression?
A pattern of characters used to match, search, or validate text.
How do I test one of these patterns?
Copy it, switch to the Regex Tester tab, and paste it into the pattern field.