Re: What this means "(\w|-)+@\w"? [message #174787 is a reply to message #174786] |
Thu, 07 July 2011 19:12 |
Michael Fesser
Messages: 215 Registered: September 2010
Karma:
|
Senior Member |
|
|
.oO(Eli the Bearded)
> In comp.lang.php, zhang yun <bigzhangyun(at)gmail(dot)com> wrote:
>> Hi,there
>> I have some problems in regular expression, here is code :
>> function is_email($e_name)
>> {
>
> That's a poorly named function. Lots and lots of valid email
> addresses will be rejected by this crappy code.
>
>> $arr = array("ac","com","net","org","edu","gov","mil","ac\.cn",
>> "com\.cn","edu\.cn","net\.cn","org\.cn");
>
> Have you heard about the new top level domains (TLDs)? .info is new as
> of, oh, about year 2000. There are some others, too. And other country
> codes.
ACK. And a lot more TLDs with arbitrary length are about to come.
In fact checking an email address with regular expressions is almost
impossible. It would make more sense to just perform a rough check like
..+@.+ and then just take it as-is. If it's valid, the email will be
sent. If not, it will bounce, but who really cares?
Micha
|
|
|