Regex Tester

Popular

Test and debug regular expressions with real-time highlighting and match information. Perfect for validating patterns before using them in your code.

4.6
1.2k uses todayLast updated: 3 days ago
//i
Enter a valid regular expression to see matches

About Regex Tester

The Regex Tester is a powerful tool for developers and text processors who work with regular expressions. It allows you to test, debug, and refine your regex patterns in real-time with visual feedback.

Key Features

  • Live Testing: See matches as you type with real-time highlighting
  • Regex Flags: Support for all JavaScript regex flags (g, i, m, s, u, y)
  • Match Information: View detailed information about your matches
  • Visual Highlighting: Clearly see what parts of your text match the pattern

What are Regular Expressions?

Regular expressions (regex or regexp) are powerful patterns used to match character combinations in strings. They are used for text search, text replacement, form validation, and many other text-processing tasks.

Common Regex Patterns

Here are some commonly used regex patterns:

  • Email validation: \b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b (with i flag)
  • URL validation: https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]256\.[a-zA-Z0-9()]6\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)
  • Phone number (US): \b\d3[-.]?\d3[-.]?\d4\b
  • Date (MM/DD/YYYY): \b(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d4\b
  • Strong password: ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

Regex Flags Explained

  • g (global): Find all matches rather than stopping after the first match
  • i (ignore case): Case-insensitive matching
  • m (multiline): ^ and $ match the start and end of each line, not just the whole string
  • s (dotAll): Allows . to match newline characters
  • u (unicode): Treat pattern as a sequence of Unicode code points
  • y (sticky): Matches only from the index indicated by the lastIndex property