Regex Tester

The Regex Tester is a tool I built to make working with regular expressions easier and a bit more fun. Regex can feel overwhelming, especially when you’re just starting out, so I wanted a simple place to experiment without stress. You can type in any regex pattern, add some sample text, and immediately see if your pattern is working the way you expect. Matches are highlighted so you can easily spot them, and I’ve also added some common regex examples to help you learn. It’s a practical, hands-on way to explore regex—perfect for both beginners and seasoned developers who just want a quick way to test their ideas.

Regex Tester

Common Regex Patterns:

  • \d - Matches any digit (0-9)
  • \D - Matches any character that is not a digit
  • \w - Matches any word character (a-z, A-Z, 0-9, _)
  • \W - Matches any character that is not a word character
  • \s - Matches any whitespace character (spaces, tabs, line breaks)
  • \S - Matches any non-whitespace character
  • .+ - Matches one or more of any character except line breaks
  • ^text - Matches "text" at the start of a line
  • text$ - Matches "text" at the end of a line
  • [abc] - Matches any character within the brackets (a, b, or c)
  • [^abc] - Matches any character that is not a, b, or c
  • [a-z] - Matches any lowercase letter from a to z
  • [A-Z] - Matches any uppercase letter from A to Z
  • [0-9] - Matches any digit from 0 to 9

Sample Advanced Patterns:

  • a{3} - Matches exactly three occurrences of the character "a"
  • a{3,} - Matches three or more occurrences of the character "a"
  • a{3,5} - Matches between three and five occurrences of the character "a"
  • (abc) - Matches the exact sequence "abc" and captures it for later reference
  • (a|b|c) - Matches either "a", "b", or "c"
  • \bword\b - Matches the word "word" as a whole word (not part of another word)
  • \Bword - Matches "word" only if it is not at a word boundary
  • ^(\d{3})-(\d{3})-(\d{4})$ - Matches phone numbers in the format "123-456-7890"
  • ^(https?):\/\/[^\s/$.?#].[^\s]*$ - Matches and captures URLs starting with "http" or "https"
  • (?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,} - Matches a password that contains at least one digit, one lowercase letter, one uppercase letter, and is at least 8 characters long
  • (?<=@)[a-zA-Z0-9._%+-]+(?=\.) - Matches the domain part of an email address (e.g., "gmail" in "user@gmail.com")
  • (?!cat\b)\b\w+\b - Matches any word except "cat"
  • (? - Matches a number that is not preceded by a dollar sign