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

Re: [FWP] IP address regex golf



>>>>> "PS" == Peter Scott <Peter@PSDT.com> writes:

  PS> At 11:24 PM 4/28/00 -0500, Keith Calvert Ivey wrote:
  >> At 28 Apr 00 17:41, Peter Scott <Peter@PSDT.com> wrote:
  >> 
  >> Peter Scott <Peter@PSDT.com> wrote:
  >> 
  >> >    /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/&&!((1|$1|$2|$3|$4)&256)
  >> 
  >> That doesn't work.  Try 512.1.1.1, for example, or anything
  >> else that has a number greater than 256 without the 256 bit
  >> set.  Try this:
  >> 
  >> /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/&&($1|$2|$3|$4)<256

  PS> You're going to need that 1| in front of that chain though,
  PS> otherwise it does a stringwise or.

which is ok as the |'s will only generate a digit string which is then
numerically compared to 256. this is golf, not real life!

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com

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