DevToolset
About

Regex Tester

Test and debug regular expressions with real-time highlighting. Validate patterns and see matches instantly.

//g
No matches found

Highlighted Matches

No matches to highlight

Common Patterns

Email Address
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
URL
https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)
Phone Number (US)
\(?\d{3}\)?[- ]?\d{3}[- ]?\d{4}
Date (MM/DD/YYYY)
(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/(19|20)\d{2}
IP Address
(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
HTML Tag
<([a-z][a-z0-9]*)\b[^>]*>.*?<\/\1>

Regex Cheat Sheet

Character Classes

  • . - Any character except newline
  • \w - Word character [a-zA-Z0-9_]
  • \d - Digit [0-9]
  • \s - Whitespace character
  • [abc] - Any character in the set
  • [^abc] - Any character not in the set

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
  • \b - Word boundary

Groups & Lookarounds

  • (abc) - Capturing group
  • (?:abc) - Non-capturing group
  • (?=abc) - Positive lookahead
  • (?!abc) - Negative lookahead