A comprehensive, well-organized regex cheat sheet that covers everything from basic metacharacters to advanced lookarounds. Whether you are a beginner learning regex or an experienced developer needing a quick reference, this guide puts the most important patterns and syntax at your fingertips.
.Match any character except newline\dMatch digit [0-9]\DMatch non-digit [^0-9]\wMatch word character [a-zA-Z0-9_]\WMatch non-word character\sMatch whitespace character\SMatch non-whitespace character\bMatch word boundary\BMatch non-word boundary[abc]Match any one character in brackets[^abc]Match any character not in brackets[a-z]Match characters in the specified range^Match start of string$Match end of string*Match previous item 0 or more times+Match previous item 1 or more times?Match previous item 0 or 1 time{n}Match previous item exactly n times{n,}Match previous item at least n times{n,m}Match previous item n to m times()Capturing group(?:)Non-capturing group(?=)Positive lookahead(?!)Negative lookahead(?<=)Positive lookbehind(?<!)Negative lookbehind|Alternation (OR)\Escape special character^[a-zA-Z0-9]+$Alphanumeric combination^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Email address^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?$URL address^1[3-9]\d{9}$Chinese mobile number^\d{4}[-/]\d{1,2}[-/]\d{1,2}$Date format YYYY-MM-DD^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$IP address (simple)^[\u4e00-\u9fa5]+$Chinese characters only^[\u4e00-\u9fa5a-zA-Z0-9]+$Chinese + letters + numbers^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^\s]{8,}$Strong password (upper+lower+digits, 8+)^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$HEX color value<[^>]+>HTML tag\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\bIP address (exact)/^(0|[1-9]\d*)(\.\d+)?$/Number (integer or decimal)iCase insensitivegGlobal matchmMultiline modesDot matches newlineuUnicode modeCharacter Classes: Match specific types of characters like digits, letters, whitespace, etc.
Quantifiers: Control match repetition with *, +, ? and {n,m}.
Common Patterns: Predefined regex patterns for email, URL, phone number, etc.
A comprehensive, well-organized regex cheat sheet that covers everything from basic metacharacters to advanced lookarounds. Whether you are a beginner learning regex or an experienced developer needing a quick reference, this guide puts the most important patterns and syntax at your fingertips.
Browse by category
Navigate through sections like Character Classes, Quantifiers, Groups, and Assertions to find the syntax you need.
Search for a token
Use the search bar to quickly find a specific regex token or concept by name or symbol.
Copy a pattern
Click the copy button next to any pattern or expression to copy it to your clipboard.
Try it live
Use the linked Regex Visualizer tool to test and debug any pattern in real time.