Regex Pattern Library
17 ready-made patterns, each one explained part by part, tested against match and no-match examples, and copy-pasteable into JavaScript, Python, SQL, GA4 and BigQuery. Click any Try link to load the pattern straight into the tester with sample data.
Not sure the pattern fits your data?
Open the tester, paste any pattern from this library, and add your own strings.
Dates & Time
- Regex to Match Dates in YYYY-MM-DD Format — Full-match an ISO-style calendar date with day/month ranges that actually hold.
- Regex to Match an ISO 8601 DateTime — Match 2026-10-28T14:30:00Z and friends, with or without offset and milliseconds.
- Regex to Match Time in HH:MM (or HH:MM:SS) Format — Range-limited 24-hour clock match, seconds optional.
Validation
- Practical Email Validation Regex — The sane email pattern: what it catches, what it deliberately skips.
- UUID Regex (8-4-4-4-12) — Match 550e8400-e29b-41d4-a716-446655440000 anywhere or full-line.
- IPv4 Address Regex (Octets Limited to 0–255) — The classic dotted-quad pattern, minus the 999 octet bug.
- Hex Color Regex (#RGB and #RRGGBB) — Match 3- or 6-digit hex colors with or without the hash.
- SemVer 2.0.0 Regex — Strict core + optional pre-release + optional build metadata.
- URL Slug Regex (lowercase-with-hyphens) — Validate seo-friendly slugs: no spaces, no double hyphens, no uppercase.
Extract & Replace
- Regex to Extract Numbers from a String — Find integers, decimals and signed values inside any text.
- Regex to Extract the Domain from a URL — One capture group: pull example.com out of any full URL.
- File Extension Regex — Match the extension at the end of a path — or the whole filename.
- Regex to Match Quoted Strings — Match "..." or '...' without leaking past the closing quote.
URLs & Marketing
- Practical URL Regex (http / https) — Match real web links in text — readable, RE2-safe, honest limits.
- Regex to Remove Query Parameters from a URL — Strip everything from ? onward (or only utm_* params) cleanly.
- UTM Parameter Regex (match & extract utm_*) — Find, extract or validate the five utm_* parameters in any URL.
Dev & Logs
- Log Level Regex (DEBUG / INFO / WARN / ERROR / FATAL) — Pull the level out of a log line, or filter whole lines by severity.
GA4 guides
- GA4 regex cheat sheet — 25+ copy-paste patterns for segments, audiences and filters.
- GA4 page path regex guide — filter page_location with full-match semantics.
- GA4 event filter regex guide — pick event names precisely.
- GA4 regex match types — full match vs partially matches, per GA4 surface.
- Custom channel grouping regex guide — build reliable channel rules.
- RE2 vs PCRE — why patterns that work in JavaScript can fail in GA4 and BigQuery.
Every pattern on this page is RE2-compatible unless its page says otherwise — meaning it also works in Google Analytics 4, BigQuery, Go and Rust. Regex matching in the tester uses your browser's native engine; check the RE2 vs PCRE differences before shipping patterns to Google tools.