0

I didnot find any kind of help for this type of email id so can you please tell me how to validate the below email using regular expression Email Id - xyzabc@co.xyz-gordo.in.zs

I am using below Pattern

^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@"+ "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$
Pshemo
  • 122,468
  • 25
  • 185
  • 269
Nirakar
  • 1
  • 1
  • 1
    What are the rules about correct and incorrect email? Also do you have to validate it? Wouldn't it be simpler to see if it is correct by sending user account activation e-mail? – Pshemo Feb 06 '14 at 09:55
  • what would you actually like the regexp to match? 'cause if it should only match the mail-address you gave us, the regexp is the address itself. I guess that by validating the address you mena "check if it's a valid email adress", but that needs a definition on what'S valid and what isnt - and the addr4ess we're verifying is unimportant. – Johannes H. Feb 06 '14 at 09:56

1 Answers1

0

For email validation use Apache commons email validator. Simple to use and you don't need to invent a wheel ;-)

1ac0
  • 2,875
  • 3
  • 33
  • 47