25 Regex Patterns Every QA Engineer Should Know
The 25 regex patterns QA engineers use daily: email, phone, URL, credit card, dates, UUIDs, log parsing, and more. Test them live in a free regex tester.

2026-07-17 · By SoftwareTestPilot
Regex is the QA engineer's Swiss Army knife: input validation, log grep, response parsing, data masking. Here are the 25 patterns worth memorising, all testable in the free Regex Tester for QA.
Validation classics
Email (RFC-lite): ^[\w.+-]+@[\w-]+\.[\w.-]+$
US phone: ^\(?\d{3}\)?[- ]?\d{3}-?\d{4}$
E.164: ^\+[1-9]\d{1,14}$
URL (http/https): ^https?:\/\/[^\s/$.?#].[^\s]*$
IPv4: ^((25[0-5]|2[0-4]\d|[01]?\d?\d)\.){3}(25[0-5]|2[0-4]\d|[01]?\d?\d)$
UUID v4: ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
ISO date: ^\d{4}-\d{2}-\d{2}$
ISO datetime: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z?$Payment & identity
Visa: ^4\d{12}(\d{3})?$
Mastercard: ^(5[1-5]\d{4}|2(2[2-9]\d{3}|[3-6]\d{4}|7([01]\d{3}|20\d{2})))\d{10}$
CVV: ^\d{3,4}$
IBAN (loose): ^[A-Z]{2}\d{2}[A-Z0-9]{11,30}$
Indian PAN: ^[A-Z]{5}[0-9]{4}[A-Z]$
US SSN: ^\d{3}-\d{2}-\d{4}$Passwords
8+ chars, 1 upper, 1 lower, 1 digit, 1 symbol:
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,}$Log & response parsing
Extract HTTP status: HTTP\/\d\.\d\s(\d{3})
Extract JWT: eyJ[\w-]+\.[\w-]+\.[\w-]+
Mask CC in logs: \b(?:\d[ -]*?){13,16}\b -> ****
Extract Bearer token: Bearer\s+([A-Za-z0-9\-._~+/]+=*)Test them live
All 25 patterns are preloaded in the Regex Tester for QA. Click any pattern, paste sample data, and export the regex as a Java, JavaScript, Python, or C# snippet.
You may also like
Related reading: Data-Driven Testing with Regex Validation — Patterns & Pitfalls.
