Regex Tester

Test regular expressions against strings with real-time feedback.

Regular Expression
//
Test String
Match Info
Total Matches0
Cheatsheet
.Any character
\wWord char [a-zA-Z0-9_]
\dDigit [0-9]
\sWhitespace
[abc]One of a, b, or c
[^abc]Not a, b, or c
^Start of line
$End of line
*0 or more times
+1 or more times
?0 or 1 time
{n}Exactly n times
(...)Capture group
(?:...)Non-capturing group

What is Regular Expression (Regex)?

A regular expression (shortened as regex or regexp) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation.

Common Regex Patterns

  • Email: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
  • Phone Number: ^\d3-\d3-\d4$
  • URL: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
  • Date (YYYY-MM-DD): ^\d4-\d2-\d2$