โ† Back to Blog
Developerยท8 min read

Regular Expressions Cheat Sheet โ€” The Only Regex Guide You Need

Regular expressions (regex) are one of the most powerful tools in a developer's toolkit โ€” and also one of the most confusing. This cheat sheet covers everything you need.

Basic Patterns

PatternMeaningExample
.Any characterh.t matches "hat", "hit", "hot"
\dAny digit\d{3} matches "123"
\wWord character\w+ matches "hello"
\sWhitespace\s+ matches spaces, tabs
^Start of string^Hello matches "Hello world"
$End of stringworld$ matches "Hello world"

Quantifiers

PatternMeaning
*0 or more
+1 or more
?0 or 1
{3}Exactly 3
{2,5}Between 2 and 5

Common Patterns

Email Validation

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

URL Validation

https?:\/\/[\w\-]+(\.[\w\-]+)+[\/\w\-.?&=%#]*

Phone Number (US)

^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$

IP Address

^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$

Test Your Regex

VedaWell's Regex Tester lets you build and test regular expressions with real-time matching, capture group highlighting, and a built-in cheat sheet. Free, no signup.

Try the free Regex Tester โ†’

90+ Free Browser Tools

All tools run locally in your browser. No downloads, no signups, complete privacy.

Browse All Tools โ†’