how can i make a regular expression to validate an email? using while | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how can i make a regular expression to validate an email? using while

5th Oct 2018, 12:00 AM
Ian Peralt
Ian Peralt - avatar
5 Answers
+ 1
^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$
5th Oct 2018, 12:08 AM
Calviղ
Calviղ - avatar
+ 4
we generally use a simpler regex for simple client side validation for emails, as shared by Calviղ. But in reality the true regex for email validation is super big, long ago I tried to do it, I ended up being depressed :-( I ll give it a try again today, Here's the code if you are interested, with valid and invalid test cases https://code.sololearn.com/cNvkmeUIC10s/?ref=app https://code.sololearn.com/cNvkmeUIC10s/?ref=app
5th Oct 2018, 3:02 AM
Morpheus
Morpheus - avatar
+ 1
thank u very very very much Morpheus!!! I really appreciate it
5th Oct 2018, 4:59 AM
Ian Peralt
Ian Peralt - avatar
0
for what country is that?
5th Oct 2018, 12:14 AM
Ian Peralt
Ian Peralt - avatar
0
for all emails
5th Oct 2018, 2:02 AM
Calviղ
Calviղ - avatar