Bluehost.com Web Hosting $6.95

Re: Validating Subdomain E-mail Addresses Using Regular Expressions

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-10-2003
Ivo Fokkema
 
Posts: n/a
Default Re: Validating Subdomain E-mail Addresses Using Regular Expressions


"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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:11 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0