Regular expression to match a backslash followed by a quote

Viewed 62084

How to write a regular expression to match this \" (a backslash then a quote)? Assume I have a string like this:

<a href=\"google.com\"> click to search </a>

I need to replace all the \" with a ", so the result would look like:

<a href="google.com"> click to search </a>

This one does not work: str.replaceAll("\\\"", "\"") because it only matches the quote. Not sure how to get around with the backslash. I could have removed the backslash first, but there are other backslashes in my string.

3 Answers
Related