regex for short. A regex is a mini-language for describing text patterns. Instead of saying "find the exact string `555-867-5309`," you say "find three digits, then a separator, then three digits, then a separator, then four digits." The regex engine handles the rest.