Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How to check if a EMail id consists a number in the first place? Then the mail id should not be accepted.

ex: 1XXX@YYY.com

What I have tried:

^[a-zA-Z0-9_.-]*$ this is the regular expression i have used.
Posted
Updated 22-May-17 2:34am

Try this:
([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})

It's straight from the Expression Library of Expresso[^] - it's free, and it examines and generates Regular expressions.
 
Share this answer
 
Comments
chandra sekhar 22-May-17 15:37pm    
Thanks for the reply.What this regular expression means (@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$")
OriginalGriff 22-May-17 16:08pm    
Copy it into Espresso, and see what it says!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900