Reputation: 1
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
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 @
Upvotes: 1