Re: [MacPerl-AnyPerl] negative lookahead problem
[email protected] (Ronald J Kimball) Fri, 10 Aug 2001 10:44:30 -0400
| Newsgroups | perl.macperl.anyperl |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Aug 10, 2001 at 12:01:25AM +0200, allan wrote:
> hi
>
> i want to do a global replace om a search string _unless_ the string is
> encapsulated in <script></script> tags.
Try this:
s{
(<script[^>]*>.*?</script>) # a script block
|
([^\s"'<>%()]+=)([^\s"'<>]+) # an assignment not in a script block
}
{
$1 # the script block matched
||
qq{$2"$3"} # the assignment match
}xsieg;
The easiest way to skip over some block of text is to just match it and
move on.
Ronald