/ Published in: PHP

It should work for domains like @something.co.uk
note that regex will never really be able to match 100% of e-mail addresses without allowing some false positives
note that regex will never really be able to match 100% of e-mail addresses without allowing some false positives
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function is_email_valid($email) { return (preg_match('/^[a-zA-z0-9._'+]+@[a-zA-z0-9]+\.([a-z0-9-]{2,4}|[a-z0-9]{2,}+\.[a-z0-9]{2,4})$/', $email) > 0) ? true : false; }
Comments
