Often when writing PHP, I will output some HTML like this -
echo "<a href="../" title="link title">".$link_text."</a>";
Obviously this will not be parsed as I need to avoid double quotes in the attributes of the element <a>. Is there a regex that would quickly do this instead of manually adding a backslash?
One more thing: the regex should not escape double quotes outside the tag (for example, where I added the variable $link_text.
Any ideas?
source
share