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

Re: [FWP] IP address regex golf



Jeff Pinyan <jeffp@crusoe.net> wrote:

> >>    4==grep $_<256,/\G(\d+)(?:\.|$)/g;
> >>    4==grep $_<256,/\G(\d+)(?:\.|\z)/g;
> 
> That doesn't work.  "1.2.3.100000.4".
> 
>       1x4==join"",map$_<256,/\G(\d+)(?:\.|\z)/g;

How is that an improvement?  It results in exactly the same 
false positives (including the example you give right before 
it).  The < operator returns '' for false, not 0 (and even if 
it returned 0, you'd need to change the == to eq to avoid give 
false positives for things like 10000.1.2.3.4, since '1111' == 
'01111').

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC

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