Regex Cookbook
Starter expressions for common marketing automation and analytics tasks. Test patterns with the Regex Tester before deployment.
URL Filtering
- Match UTM parameters:
utm_[a-z]+=([^&]+) - Exclude query strings:
^[^?]+ - Capture URL slug:
(?:https?://[^/]+)?/([^/?#]+)
Log File Parsing
- Extract status codes:
"\s(\d{3})\s - Find redirect chains:
\s30[12]\s - Capture response time:
time=(\d+\.\d+)
Content QA
- Detect double spaces:
\s{2,} - Find passive voice verbs:
\b(is|was|were|be|been|being)\s+\w+ed\b - Identify placeholder text:
\b(lorem ipsum|tbd|placeholder)\b
Email Campaigns
- Capture merge tags:
{{[^}]+}} - Find subject line emojis:
[\x{1F300}-\x{1F6FF}] - Validate unsubscribe links:
https?://[^\s]+unsubscribe
Document custom patterns below for team reuse.