Jump to content

[SOLVED] preg_match - checking valid email address


nutt318

Recommended Posts

For some reason this is not working and I suck at regex crap. Is there a reason why im getting back 'invalid email address' when using a [email protected]

 

This should work right?

 

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $userEmail)) {
  echo "<h3>Invalid Email Address</h3>";
  echo "<a href='javascript:history.back(1);'>Back</a>";

Of course, I messed up, It should have been. I missed the capitol letter. DOH

 

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $useremail)) {
  echo "<h3>Invalid Email Address</h3>";
  echo "<a href='javascript:history.back(1);'>Back</a>";

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.