Regex Tester

Test regular expressions with real-time matching and highlighting. Uses JavaScript regex engine.

/ /
 

Common Regex Patterns

PatternDescriptionExample Match
[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z]{2,}Email addressuser@example.com
https?://[^\s]+URLhttps://example.com
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\bIPv4 address192.168.1.1
^\d{4}-\d{2}-\d{2}$Date (YYYY-MM-DD)2026-01-15
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$Hex color#ff5733

Regex Quick Reference

TokenDescription
.Any character except newline
\dDigit [0-9]
\wWord character [a-zA-Z0-9_]
\sWhitespace
*0 or more
+1 or more
?0 or 1
{n,m}Between n and m times
^Start of string/line
$End of string/line
(abc)Capture group
[abc]Character class
a|bAlternation (a or b)

Frequently Asked Questions

What is a regular expression (regex)?
A regular expression is a sequence of characters that defines a search pattern. Regex is used for string matching, validation, search-and-replace, and data extraction in virtually every programming language.
What do regex flags like g, i, and m mean?
The 'g' flag enables global matching (find all matches, not just the first). The 'i' flag makes matching case-insensitive. The 'm' flag enables multiline mode where ^ and $ match line starts/ends.
How do I match an email address with regex?
A common email regex pattern is: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ — though perfect email validation with regex is extremely complex. For production use, consider using your language's built-in email validation.
Keyboard Shortcuts
Ctrl+Enter Run / Format
Ctrl+Shift+C Copy output
Ctrl+L Clear