Often, when writing PHP, I'll have it output some HTML content like this:
echo "<a href="../" title="link title">".$link_text."</a>";
Obviously, this won't parse as I need to escape the double quotes in the attributes of the <a> element. Is there a regular expression that would quickly do this rather than me manually adding the backslashes?
One other thing: The regular expression shouldn't escape double quotes outside of the tag (e.g., where I've appended the $link_text variable.
You should just use single quotes instead:
echo '<a href="../" title="link title">' . $link_text . '</a>';