Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

RegEx for email so that it fails if the email does not have at least 1 letter somewhere before the @

I have tried to find a solution to my problem here and here but without luck.
I have written these 2 RegExes for email validation which pretty meet almost all of my criteria
RegEx 1
^\w?[A-Za-z]{1}\w?@[a-z]+.[a-z]{2,}(.[a-z]{2,}){0,1}$
RegEx 2
[\w.-]+@[a-z]+.[a-z]{2,}(.[a-z]{2,}){0,1}$

But they do not solve 1 critical issue.
I want the RegEx to fail when matched with something like:
_@gmail.com
_@gmail.com
8
@gmail.com
8@gmail.com
88@gmail.com
8
@gmail.com

So basically I want the email to have at least 1 lower or upper case letter and it does not matter it is at the beginning , middle or end of the email itself(before the @).

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Could you please help me with this?

>Solution :

Use this.

^\w*[A-Za-z]\w*@[a-z]+.[a-z]{2,}(.[a-z]{2,}){0,1}$

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading