[nycphp-talk] Validating Email Addresses
drydell at att.net
drydell at att.net
Thu Dec 2 14:07:07 EST 2004
I didn't see that it was strrpos, not strpos...
-------------- Original message ----------------------
From: Rahmin Pavlovic <rahmin at insite-out.com>
>
> On Thu, 02 Dec 2004 18:50 , drydell at att.net sent:
>
> >a problem here is that a valid email address like firstname.lastname at domain.com
> would be rejected...
>
>
> Those are acceptable. It simply makes sure the last occurrence of the '.'
> exists after the @ symbol.
>
>
> > -------------- Original message ----------------------
> >From: Rahmin Pavlovic rahmin at insite-out.com>
> >> I wrote this a while back, as I'm somewhat illiterate when it comes to
> regexp's:
> >>
> >> function is_email($str) {
> >> $str=trim($str);
> >> if($str=='') { return false; }
> >> if(strstr($str,'@')=='' || strstr($str,'.')=='') { return false; }
> >> if(strpos($str,'@') > strrpos($str,'.')) { return false; }
> >> if(strpos($str,'@')
> >> if((strrpos($str,'.') - strpos($str,'@'))
> >> if((strlen($str) - strrpos($str,'.'))
> >> return true;
> >> }
> >>
> >> It's slightly liberal, but does force input to x at xx.xx. That should would
> work
> >> for cases like Joe joe at bob.com>.
> >>
> >> HTH
> >>
> >>
> >> _______________________________________________
> >> New York PHP Talk
> >> Supporting AMP Technology (Apache/MySQL/PHP)
> >> http://lists.nyphp.org/mailman/listinfo/talk
> >> http://www.newyorkphp.org
> >
> >
> >_______________________________________________
> >New York PHP Talk
> >Supporting AMP Technology (Apache/MySQL/PHP)
> >http://lists.nyphp.org/mailman/listinfo/talk
> >http://www.newyorkphp.org
>
>
>
>
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
More information about the talk
mailing list