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

Re: [MacPerl] Regular Expression Problem... (5.005 related)



At 9:29 -0700 2000.09.08, Andrew O. Mellinger wrote:
>   Hmm.  Okay, I've got a script that does
>
>   $value =~ s+(?<!<)(http://[\S]*)+<a href=\"$1\">$1</a>+g;
>
>   but it doesn't compile under 5.004 it gets a:
>
>   Sequence (?<...) not recognized.

Right.


>   I was told that the "It's zero-width look-behind sequence."   I
>seem to be having trouble finding info in my Regular Expressions book
>or Perl books.  What does this mean?

Well, MRE was not written when perl 5.005 was out, so it won't include it.
?<! is negative lookbehind, ?<= is positive lookbehind.  So /(?<!<)http/ is
saying "match http except after a <", I believe.

You could rewrite it in various ways, probably, though I can't think of a
good way offhand (I've used the negative lookbehind when I've needed it, on
Unix, of course).

-- 
Chris Nandor                      pudge@pobox.com    http://pudge.net/
Open Source Development Network    pudge@osdn.com     http://osdn.com/



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org