I would like to replace all double with single quotes inside a html tag, i.e. perform the substitution only for html tag attributes, but not outside tag boundaries.
my $string = qq|<a href="http://someurl.url" title="welrkwlekrj">aha</a>, and here "follows" a quoted expression: "blabla"<img src="http://someimage.gif" width="80" height="200">|; All double quotes should be replaced by single ones except those surrounding the string "blabla". My approach would be: Look for <, followed by a string of characters except >, followed by" - if matched, replace this instance of " with '. I found the following code to work, but it strikes me as very clumsy and I am not sure whether it captures all relevant cases and really excludes all those which are not relevant. while ($string =~ /(<[^>]*?)"/gs) { my $var = $1; $string =~ s/$var"/$var'/;} print qq|$string\n|; The only case I found so far that it doesn't cover is when tag attributes themselves contain a ">"-character, like: <img src="http://someimage.gif" alt="8 > 4"> As always, suggestions and comments will be greatly appreciated, Birgit Kellner -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]