Imran
Imran

Reputation: 1

Email Format Expression, it should check after @ must be minimum 2 character before .com

I used this expression for email validation

/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/i 

It's accepting aslo [email protected] but I want user will need to input at least 2 character after @ and before .com to make it true

Upvotes: 0

Views: 28

Answers (1)

Jens
Jens

Reputation: 69440

Change to:

/^[a-z0-9._%+-]+@[a-z0-9.-]{2,}\.[a-z]{2,4}$/i 
                          ^^^^

Have added the rule that there must be atleast two charcters after the @

https://regex101.com/

Upvotes: 1

Related Questions