Regular Expression Tester

Regular Expression

/ /
Full Regular Expression: /\d{3}-\d{4}/g

Test Text

Match Results

Match results will be highlighted here...
Index Matched Content Position Grouping
No match results yet

Replace function

Regex Quick Reference

Character classes

  • . - Any character (except newline)
  • \d - Digit [0-9]
  • \D - Non-digit
  • \w - Word character [A-Za-z0-9_]
  • \W - Non-word character
  • \s - Whitespace character
  • \S - Non-whitespace character

Quantifiers

  • * - Zero or more times
  • + - One or more times
  • ? - 0 or 1 time
  • {n} - Exactly n times
  • {n,} - At least n times
  • {n,m} - Between n and m times

Position

  • ^ - Start of line
  • $ - End of line
  • \b - Word boundary
  • \B - Non-word boundary

Grouping

  • (abc) - Capturing group
  • (?:abc) - Non-capturing group
  • a|b - Or (a or b)
  • [abc] - Character set
  • [^abc] - Negated character set

Common regex examples: