Re: Regex validation
| From: | Ashley Sheridan | Date: | Wed, 29 Oct 2008 00:10:04 +0000 |
| Subject: | Re: Regex validation | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282548@lists.php.net to get a copy of this message | ||
On Tue, 2008-10-28 at 18:07 -0500, Micah Gersten wrote:
> Keep in mind that ereg will disappear with PHP 6. You might want to use
> the preg functions:
>
> http://www.making-the-web.com/2007/09/21/becoming-php-6-compatible/
>
> Thank you,
> Micah Gersten
> onShore Networks
> Internal Developer
> http://www.onshore.com
>
>
>
> VamVan wrote:
> > Thank Guys,
> >
> > I at least got part of it working , not the double words but almost
> > everything else than that:
> >
> > function _email_validate($mail_address){
> > $invalid_charset_pattern = "[(*+?)|~<>:;{}/ ]";
> > if(ereg($invalid_charset_pattern, $mail_address)){
> > return false;
> > }else{
> > return true;
> > }
> > }
> >
> > Thanks for the inputs
> >
> > On Tue, Oct 28, 2008 at 3:31 PM, Nitsan Bin-Nun <nitsan@binnun.co.il
> > <mailto:nitsan@binnun.co.il>> wrote:
> >
> > Good to know filter_var() exists in PHP5
> >
> > Unless you have PHP5 you better validate the string in the way of
> > checking
> > if it is fit's to your allowed characters and not checking if it
> > contains
> > the NOT allowed charaters.
> >
> > You better use: [a-z0-9A-Z\_\.]+ instead of
> > [^\)\(\*\&\^\%\$\#\@\!\~]+ and I
> > haven't started yet with the weirdy ones....
> >
> > HTH,
> > Nitsan
> >
> > On Wed, Oct 29, 2008 at 12:10 AM, Yeti <yeti@myhich.com
> > <mailto:yeti@myhich.com>> wrote:
> >
> > > > If your trying to filter E-Mail addresses, then filter_var is
> > what you
> > > > should use:
> > > >
> > > > http://php.net/filter_var
> > >
> > > If the OP (original poster) got PHP5+
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit:
> > > http://www.php.net/unsub.php
> > >
> > >
> >
> >
>
Also, according to the official spec, +, < and > are all valid email
address characters.
Ash
www.ashleysheridan.co.uk