> >

Email Regex Patterns & Validation

Copy-paste ready regex patterns for email validation

Generate Custom Regex

Create custom regex patterns without memorizing complex syntax:

Use Regex Generator

Email Regex Patterns for Developers

Email validation is one of the most common regex use cases. Below are 5 proven regex patterns that work in most programming languages. Choose based on your needs.

1. Basic Email Validation

Simple email format validation

^[^\s@]+@[^\s@]+\.[^\s@]+$

Examples that match:

  • user@example.com
  • john.doe@company.co.uk
  • test123@domain.org

2. RFC 5322 Compliant

More comprehensive RFC standard compliance

^[a-zA-Z0-9.!#$%&'*+/=?^_`{{ '{}' }}|~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{{ '{' }}0,61{{ '}' }}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{{ '{' }}0,61{{ '}' }}[a-zA-Z0-9])?)*$

Examples that match:

  • user+tag@example.com
  • first.last@sub.domain.com
  • test_email@domain.co.uk

3. Gmail-style Email

Match only Gmail addresses

^[a-zA-Z0-9._-]+@gmail\.com$

Examples that match:

  • john.smith@gmail.com
  • user123@gmail.com
  • test_email@gmail.com

4. Corporate Email (company.com)

Limit to single company domain

^[a-zA-Z0-9._-]+@company\.com$

Examples that match:

  • john@company.com
  • hr.dept@company.com
  • support@company.com

5. Email Username Part Only

Extract username before @

^[a-zA-Z0-9._-]+(?=@)

Examples that match:

  • john
  • john.doe
  • user_123

FAQ

Which regex should I use?

Use the "Basic Email Validation" for most cases. Use "RFC 5322 Compliant" for strict validation.

Do these work in JavaScript/Python/PHP?

Yes! These patterns work in all major programming languages. Minor syntax adjustments may be needed.

Can I use these in HTML?

Yes! You can use these patterns in the "pattern" attribute of HTML5 email inputs.

Is regex the best way to validate emails?

Not always. For server-side validation, sending a confirmation email is more reliable.