Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2691

Re: What this means "(\w|-)+@\w"?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Sandman <mr@sandman.net>
Newsgroups comp.lang.php
Subject Re: What this means "(\w|-)+@\w"?
Date Tue, 02 Aug 2011 10:06:17 +0200
Lines 45
Message-ID <mr-0FA206.10061702082011@News.Individual.NET> (permalink)
References <b2cdc780-b6d4-4b6e-a01e-444a616c0fe0@r18g2000vbs.googlegroups.com> <iv68tf$fla$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 8bit
X-Trace individual.net gsR3XV/6BMsazNCSE7KYKAFwBVREyYs7B61qxHDQ8ZjjXW7vs=
X-Orig-Path mr
Cancel-Lock sha1:7pN2YQvnknFgtXsV++sc2Oh7mhA=
User-Agent MT-NewsWatcher/3.5.2 (Intel Mac OS X)
X-Face $@,Vfa$,)%=Qa7L]y)&oZj_\EiHc}}A<Y3TvbI2&|e"bE9zc[o<ThMgB4%*L$b1YsNl!/ <lHO$>f0Bei"4a_%)"c6TQ+P/:53>;PNGuWUmkqyeN-qM65foJ[;T_(k;>]&G\T4Lhm:2 ujye2_,iUJFE;NZn>y;.|-hl7g~bIOF1qG\o<?]4mXkW*mT3]{Bn&VwP7(M0uYnGA!V!? {"y?BkBDW6e-.=I5
X-Killfiled yttrx, gallopinginsanity.com, Mark Kent, Maverick, Nasht.n, NRen2, MuahMan, weedhopper, PC Guy, Brian, nospam@nospam.com, Oxford, Jim Lee Jr., Mocassin Joe, zara, Chance Furlong, Robert Whelan, jt2002a@hotmail.com
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:2691

Show key headers only | View raw


In article <iv68tf$fla$1@dont-email.me>,
 "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> 
 wrote:

> > I have some problems in regular expression, here is code :
> >      function is_email($e_name)
> > {
> > 	$arr = array("ac","com","net","org","edu","gov","mil","ac\.cn",
> > 				"com\.cn","edu\.cn","net\.cn","org\.cn");
> > 	$str = implode("|",$arr);
> > 	$reg ='/^[0-9a-zA-z](\w|-)+@\w+\.('.$str.')$/';
> > 	//echo $reg;
> > 	if(preg_match($reg,strtolower($e_name)))
> > 		return strtolower($e_name);
> > 	else
> > 		return false;
> > }
> 
> As already mentioned, it's a terrible way to validate e-mails. Among 
> other omissions, it discards like a hundred valid top level domains:
> 
> http://en.wikipedia.org/wiki/List_of_Internet_TLDs
> 
> If you are interested in the subject, I suggest you read this forum entry:
> 
> http://stackoverflow.com/questions/2514810/php-email-validation-question/25150
> 58#2515058
> 
> I'd say the best options is to write your own simple and permissive 
> expression, although you can also use a reliable third-party library and 
> keep it updated. (I found 
> http://code.google.com/p/php-email-address-validation/ but I have no 
> references about it.)

What's wrong with the PHP built in email validator?

<?
    if (filter_var($email, FILTER_VALIDATE_EMAIL)){
        # Do fancy stuff, such as sending fancy email!
    }
?>


-- 
Sandman[.net]

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What this means "(\w|-)+@\w"? zhang yun <bigzhangyun@gmail.com> - 2011-07-07 06:58 -0700
  Re: What this means "(\w|-)+@\w"? Michael Fesser <netizen@gmx.de> - 2011-07-07 17:39 +0200
  Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-07-07 18:23 +0000
    Re: What this means "(\w|-)+@\w"? Michael Fesser <netizen@gmx.de> - 2011-07-07 21:12 +0200
    Re: What this means "(\w|-)+@\w"? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-07 21:12 +0200
      Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-07-08 06:05 +0000
  Re: What this means "(\w|-)+@\w"? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-07-08 08:42 +0200
    Re: What this means "(\w|-)+@\w"? Sandman <mr@sandman.net> - 2011-08-02 10:06 +0200
      Re: What this means "(\w|-)+@\w"? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-02 11:50 +0200
        Re: What this means "(\w|-)+@\w"? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-02 07:56 -0500
          Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-08-02 20:53 +0000
            Re: What this means "(\w|-)+@\w"? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-03 08:32 -0500
          Re: What this means "(\w|-)+@\w"? "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-08-03 10:55 +0200
            Re: What this means "(\w|-)+@\w"? "Peter H. Coffin" <hellsop@ninehells.com> - 2011-08-03 08:46 -0500
        Re: What this means "(\w|-)+@\w"? Sandman <mr@sandman.net> - 2011-08-03 00:21 +0200
          Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-08-03 07:45 +0000
            Re: What this means "(\w|-)+@\w"? Sandman <mr@sandman.net> - 2011-08-03 10:02 +0200
              Re: What this means "(\w|-)+@\w"? Eli the Bearded <*@eli.users.panix.com> - 2011-08-05 00:05 +0000

csiph-web