Can someone please edit:
if ( !eregi( "0-9a-z0-9a-z\.[a-z]{2,3}$", $dinemail ) ) error( "Wrong." );
so it accepts the email address name_@domain.com (name_ATdomain.com)?
Thanks!
There are about eleventy billion different ways to verify an e-mail address. My personal favorite is:
preg_match('/[-.\w]+@[-.\w]+.[\w]{2,4}$/', $email);
Would it accept name.@domain.com? Nowadays, the letters é,å,ä,ö,ü etc are accepted in .nu-domains, are they accepted by this email check?
Originally posted by majik-sheff There are about eleventy billion different ways to verify an e-mail address. My personal favorite is: preg_match('/[-.\w]+@[-.\w]+.[\w]{2,4}$/', $email);
If I'm reading your regex right this email would fail
tome@corp.ptd.net
You must not be reading it right then.. Try it 🙂
And to answer your quesiton about accented characters: no, it will not, but if you modify the code like this:
preg_match('/[-.\w\300-\377]+@[-.\w]+.+[\w]{2,4}$/', $email);
It will.
Would
preg_match('/[-.\w\300-\377]+@[-.\w]+.+[\w\300-\377]{2,4}$/', $email);
accept letters like é,å,ä,ö,ü in the domain name?
/Daniel
Right idea, wrong location. This is how it should look:
preg_match('/[-.\w\300-\377]+@[-.\w\300-\377]+.+[\w]{2,4}$/', $email);