🎯 Regex Playground

Test regex patterns across different programming languages

Select Regex Engines:

Regular Expression Pattern

/ /
g i m s u x

Test String

Results by Engine

📊 Feature Comparison

📚 Quick Reference & Examples

Email Address
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
Phone Number
^(?:(?:\+|00)?\d{1,3}...)
URL
^https?://[^\s/$.?#].[^\s]*$
Strong Password
^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)...
Hex Color
^#?([a-f0-9]{6}|[a-f0-9]{3})$
IPv4 Address
^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$
Full Name
^(?!.*\s{2})(?!^\s)(?!\s$)[a-zA-Z\s]{2,50}$
Date (YYYY-MM-DD)
^\d{4}-\d{2}-\d{2}$

Character Classes

.Any character except newline
\dDigit [0-9]
\DNot a digit
\wWord character [a-zA-Z0-9_]
\WNot a word character
\sWhitespace [ \t\n\r\f\v]
\SNot whitespace

Quantifiers

*0 or more
+1 or more
?0 or 1
{n}Exactly n times
{n,}n or more times
{n,m}Between n and m times

Anchors

^Start of string/line
$End of string/line
\bWord boundary
\BNot word boundary

Groups

(...)Capturing group
(?:...)Non-capturing group
(?<name>...)Named group
(?=...)Positive lookahead
(?!...)Negative lookahead
(?<=...)Positive lookbehind

Extract Domain from Email

Pattern: @(\w+\.\w+)
Test: user@example.com → example.com

Validate Strong Password

Pattern: ^(?=.*[A-Z])(?=.*[a-z])(?=.*\d).{8,}$
Test: Must have uppercase, lowercase, digit, 8+ chars

Extract Hashtags

Pattern: #(\w+)
Test: #regex #coding #javascript

Remove Extra Whitespace

Pattern: \s+
Replace with: Single space