--On Montag, 31. Dezember 2001 01:57 -0800 "John W. Krahn" <[EMAIL PROTECTED]>
wrote:
> Here is the verbose version.
>
> $string =~ s{ # start regular expression
> ( # start capture
> < # match a less-than symbol
> [^>]+ # match one or more characters not a
> greater-than symbol > # match a greater-than symbol
> ) # end capture
> }
> { # start replacement expression
> $a = $1; # can't modify $1 so copy it
> $a =~ tr|"|'|; # replace double quotes with single quotes
> $a # use this new string to replace the old one
> }gex; # g = global pattern match
> # e = evaluate the replacement expression
> # x = allow whitespace and comments
>
Yes, the decisive point - if I understand it correctly - is that it
performs the translation only within $1, i.e. within the match for text
surrounded by pointed brackets.
Many thanks for the code, by the way. I think I can use it, even though
there remains one case where it doesn't work:
<img src="http://someimagefile.jpg" alt="A > B">
That is, cases where tag attributes themselves contain pointed brackets
(which is, AFAIK, legal).
Birgit Kellner
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]