Regex Tester & Debugger

Test and debug regular expressions with real-time matching and highlighting. Perfect for learning and testing regex patterns.

//
Active flags: g

What is Regex?

Regular expressions (regex) are patterns used to match character combinations in strings. They're incredibly powerful for searching, validating, and manipulating text.

Common Regex Patterns

  • Email: ^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
  • Phone: ^\+?[1-9]\d{1,14}$
  • URL: ^https?://[^\s/$.?#].[^\s]*$
  • Hex Color: ^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
  • IP Address: ^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$

Common Flags

  • g (global): Find all matches rather than stopping after first match
  • i (ignore case): Case-insensitive matching
  • m (multiline): ^ and $ match start/end of lines, not just string
  • s (dotall): . matches newline characters
  • u (unicode): Enable full Unicode matching

Special Characters

  • . - Any character except newline
  • * - 0 or more repetitions
  • + - 1 or more repetitions
  • ? - 0 or 1 repetition
  • \d - Any digit (0-9)
  • \w - Any word character (a-z, A-Z, 0-9, _)
  • \s - Any whitespace character
  • ^ - Start of string/line
  • $ - End of string/line