I'm writing a web application in ASP.NET. I need help with regular expressions. I need two expressions, the first one that can help me get and finally replace every double quote character that is in HTML tag with single quote, and the second one that can get and replace every double quote that is not a part of HTML tag with "
.
For example:
<p>This is a "wonderful long text". "Another wonderful ong text"</p> At least it should be. Here we have a <a href="http://wwww.site-to-nowhere.com" target="_blank">link</a>
Should be changed like so.
<p>This is a "wonderful long text". "Another wonderful ong text"</p> At least it should be. Here we have a <a href='http://wwww.site-to-nowhere.com' target='_blank'>link</a>
I have tried the following expression:
"([^<>]*?)"(?=[^>]+?<)
But the problem is that it cannot catch the "Another wonderful ong text"
probably because its next to the </p>
tag.
Can you help me with this problem? Or maybe are there any other solutions to resolve this replacement problem in .NET?
..
`. (Notice the single quote inside the double quoted attribute value.) – ridgerunner Feb 13 '15 at 18:16