February 28, 20261 min readby TunnuTHub
Regex Cheat Sheet for Developers
A quick reference guide for regular expressions with common patterns for email, URL, phone number validation, and more.
regexdeveloper-toolscheat-sheet
Basic Syntax
| Pattern | Meaning |
|---------|---------|
| . | Any character except newline |
| \d | Digit (0-9) |
| \w | Word character (a-z, A-Z, 0-9, _) |
| \s | Whitespace |
| ^ | Start of string |
| $ | End of string |
Quantifiers
| Pattern | Meaning |
|---------|---------|
| * | 0 or more |
| + | 1 or more |
| ? | 0 or 1 |
| {3} | Exactly 3 |
| {3,5} | Between 3 and 5 |
Common Patterns
Email Validation
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
URL
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
Phone Number (US)
^(\+1)?[-.\s]?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$
Strong Password
At least 8 chars, 1 uppercase, 1 lowercase, 1 number, 1 special:
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
IPv4 Address
^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$
Try It Live
Test any regex pattern instantly with our Regex Tester — real-time matching, flags toggle, and match details.