This is a discussion on Re: Validating Subdomain E-mail Addresses Using Regular Expressions within the PHP General forums, part of the PHP Programming Forums category; "Jami Moore" <jami@jamisniche.com> wrote in message news:000001c375cf$aeb3b9c0$3900cf0c@Katya... > I have ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
"Jami Moore" <jami@jamisniche.com> wrote in message news:000001c375cf$aeb3b9c0$3900cf0c@Katya... > I have been trying all weekend to get this right, and so far it does not > validate an e-mail address with a subdomain. > > -- Code -- > > $empatt = > "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; > > if(eregi($empatt, $email)) > { > //do stuff > } > > -- End Code -- Try this pattern (which I use): "^[-+.0-9A-Z_a-z]+@[-+.0-9A-Z_a-z]+\.[A-Za-z]{2,4}$" HTH, Ivo |