HubTools

Regex Tester

Test and debug regular expressions with real-time matching, replacement, and splitting.
Real-timeMatch/Replace/SplitCommon Patterns
Pattern
//g
Global (g)
Case Insensitive (i)
Multiline (m)
DotAll (s)
Unicode (u)
Test String
Results
Enter a pattern and test string to see matches.
Common Patterns
  • Email

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

    https?://[^\s]+
  • Phone (US)

    \(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}
  • IP Address

    \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b
  • Date (YYYY-MM-DD)

    \d{4}-\d{2}-\d{2}
  • Hex Color

    #[0-9a-fA-F]{6}
Quick Reference
TokenDescription
\dDigit (0-9)
\DNon-digit
\wWord character (a-z, A-Z, 0-9, _)
\WNon-word character
\sWhitespace
\SNon-whitespace
.Any character (except newline)
^Start of string/line
$End of string/line
*0 or more
+1 or more
?0 or 1 (optional)
{n}Exactly n times
{n,m}Between n and m times
[abc]Character class
[^abc]Negated character class
(abc)Capturing group
(?:abc)Non-capturing group
a|bAlternation (a or b)
\bWord boundary