[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] IP address regex golf



michael salmon wrote:
> for(split/\./){++$x if($_<256)}if($x==4){}

The problem with that is that it passes things like

  127.666.666.666.666.666.0.0.1

and

  www.foo.bar.com

If you like that, then maybe you'll like 

  grep{$_>255}split/\./ or

which passes things like

  127.0

and

  foo

-- 
John Porter

A pound of cure is worth a megaton of homeopathy.


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe