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

Re: [MacPerl] Peter's Perl Predicament



link@tss.no (Terje Bless) writes:
>>At 12:33 PM 2/12/96, Peter wrote:
>>>However, Matthias said this :-
>>>>
>>>>if (/GET (http://[^/]+)?(\S+)/) {
>>>>    if (.nz) {
>>>>        $NZHits{$2}++;
>>>>    } elsif (.au) {
>>
>>>This is the bit I don't understand, I've tried various things without succes
s.
>[SNIP]
>>>If anyone can spare the time to help me out here I'd be very grateful.
>>
>>Ok.  Get yourself a UNIX box for a minute, and at the command line type
>[SNIP]
>>$2 thing in there.  Sorry I can't help beyond that, but basically he is
>>testing (in a complex manner) for url's.
>
>Actually, shouldn't that test fail since he isn't escaping the slashes in
>:// in the regex. The way I read the above script the regex is:
>
>/GET (http:/
>
>And the rest of the line (/[^/]+)?(\S+)/) is just garbage ?

Good point. I should have written the test as if (m|GET (http:// ... ) ... |).
It was never intended to be more than pseudocode, but with such an obvious
flaw, it's maybe a little *too* pseudo.

Matthias

-----
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://err.ethz.ch/members/neeri.html
  "And that's why I am going to turn this world upside down, and make
   of it a fire so *bright* that someone real will notice"
                                -- Vernor Vinge, _Tatja Grimm's World_