Regular expressions (regex) are one of the most powerful text-processing tools available — and one of the most misunderstood. Once you learn the basics, you will use them constantly for validation, search-and-replace, and data extraction.
Try it free — no signup required
Regex Tester
Basic Syntax
abc Matches the literal string "abc"
. Matches any single character (except newline)
d Matches any digit [0-9]
w Matches word characters [a-zA-Z0-9_]
s Matches whitespace (space, tab, newline)
D W S Uppercase = opposite (non-digit, non-word, non-space)Quantifiers
* Zero or more
+ One or more
? Zero or one (optional)
{3} Exactly 3
{3,} 3 or more
{3,6} Between 3 and 6Real-World Examples
Email validation
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$
Test: user@example.com ✅
Test: not-an-email ❌Indian phone number
^(+91|91|0)?[6-9]d{9}$
Test: +919876543210 ✅
Test: 9876543210 ✅
Test: 1234567890 ❌ (doesn't start with 6-9)Extract all URLs from text
https?://[^s/$.?#].[^s]*
Matches: https://eazytools.net/blog
Matches: http://example.com/path?q=1Flags
/pattern/g Global — find all matches, not just the first
/pattern/i Case insensitive — "hello" matches "Hello", "HELLO"
/pattern/m Multiline — ^ and $ match line starts/ends💡
Use the EazyTools Regex Tester to test your patterns in real time with live highlighting — no more copy-pasting into code to test.
Try it free — no signup required
Regex Tester