SoftwareTestPilot
Manual TestingPublished: 8 min read

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.

SoftwareTestPilot
QA Editorial Team
Share:XLinkedInWhatsApp
Regex patterns cheat sheet for QA engineers
Regex patterns cheat sheet for QA engineers

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.

Frequently asked questions

1.Which regex flavour should I learn?
PCRE / JavaScript. Java's Pattern class and Python's re are very close subsets.
2.Is the email regex 100% RFC compliant?
No. A truly RFC 5322 email regex is huge and impractical. Most teams use a pragmatic pattern and rely on a confirmation email.
3.How do I avoid catastrophic backtracking?
Avoid nested quantifiers on the same character class. Prefer possessive quantifiers or atomic groups where supported.
4.Are regexes the right tool for HTML parsing?
No. Use a DOM parser. Regex is fine for line-oriented text and log parsing.