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.

Avinash Kamble
Founder & QA Engineer at SoftwareTestPilot
Reviewed by Priyanka G.
Share:XLinkedInWhatsApp

2026-07-17 · By Avinash Kamble, reviewed by Priyanka G.

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.
Keep going

Practice these questions

Run a live QA mock interview tailored to this topic and get per-skill scoring in minutes.

Found this useful?
Share:XLinkedInWhatsApp

Was this article helpful?

Cluster · Manual Testing

More from Manual Testing Basics

Test types, defect lifecycle, exploratory testing.

Pillar guide · 28 articles
More in this cluster
From the Manual Testing pillar

Keep building your QA edge

Continue reading

Join the QA Community

Connect with fellow testers, share job leads, and get career advice.

Premium QA Resources

Stop Reinventing the Wheel. Upgrade Your QA Arsenal.

Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.

  • Ready-to-use testing strategy templates
  • Advanced API & UI automation guides
  • ⏱️ Save 10+ hours a week on test planning
4.9/5 rating
Explore All Products

⭐⭐⭐⭐⭐ Trusted by 1,000+ Software Test Pilots • Instant Access