Jump to content

validate email


chriscloyd

Recommended Posts

I do not know whats going on.  I have tried two different methods of validating and email and it keeps saying invalid email

I have even tried to debug it by putting errors and nothing

i have tried

preg_match("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$^", $e)

and

fliter_var($e, FLITER_VALIDATE_EMAIL);

 

the email i am trying to debug is a valid one.  its one I use daily.  I have tried different emails and still no luck.... someone help me please!

Link to comment
https://forums.phpfreaks.com/topic/262060-validate-email/
Share on other sites

hi,

 

zend has neat validation libraries, so does CI and you can browse the code directly on github. c'mon now, it's not that hard to find a email validation function.

 

but anyways, try:

preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/", $e);

 

Edit:

hmm wait a sec, your regex is identical to mine. apart from the domain length... which email are you trying to validate? if you have a domain like .info your regex will return false since it accepts only 3 chars to the extension.

Link to comment
https://forums.phpfreaks.com/topic/262060-validate-email/#findComment-1342943
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.