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

RE: [FWP] IP address regex golf



>/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/&($1|$2|$3|$4)<256

This is certainly beatable.

$f='(\d+)\.';/^$f$f$f(\d+)$/&($1|$2|$3|$4)<256

I'd like to shorten it by moving the <256 test into the regex, using the
(?()...) construct, but can't seem to get it to work.  Has anyone headed
down that road yet?

I'm thinking something along these lines:
$l='(\d+)(?($+>255)die)';/^$l\.$l\.$l\.$l$/

Btw, where can we find more information on the golf tourney?  Do you have to
attend TPC to enter?

++t

"Windows generated more revenue for Microsoft in a day than all the Linux
sales for the entire year."   -- cnet.com


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