Regex Tester
Test regular expressions in real time. Matches highlighted instantly, capture groups shown, flags support and a built-in pattern library.
^[\w.-]+@[\w.-]+\.[a-z]{2,}$
Email address
https?:\/\/[^\s/$.?#].[^\s]*
URL
^\+?[1-9]\d{7,14}$
Phone number
^\d{4}-\d{2}-\d{2}$
Date (YYYY-MM-DD)
\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
IPv4 address
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
UUID
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
HEX color
(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$]).{8,}
Strong password
^[a-zA-Z0-9_-]{3,20}$
Username (3-20 chars)
^\d{5}(-\d{4})?$
US ZIP code
\b(\w+)\s+\1\b
Duplicate words
Frequently Asked Questions
What regex flavour does this use?
JavaScript RegExp (ECMAScript). This is the same engine used in Node.js, browsers, and most frontend frameworks. It supports lookaheads, lookbehinds, named groups and Unicode properties.
What do the flags mean?
g (global) finds all matches not just the first. m (multiline) makes ^ and $ match start/end of each line not just the string. i (case insensitive) treats A and a as the same. s (dot all) makes . match newlines too.
How do I use capture groups?
Wrap part of your pattern in () to create a capture group. Groups are numbered from left to right starting at 1. In the replace field use $1, $2 etc. to insert group content. Named groups use (?<name>...) syntax.