Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次のような文字列があります。
<a href=\"test\" />
/"toを次の"ように置き換えたいと思い<a href="test" />ます。
/"
"
<a href="test" />
したがって、私はこのコードを使用しています:
content = content.replaceAll("\\\"", "\"");
なぜか見つからない\"。なので交換はしていません。
\"
このコードを試してください:string.replaceAll(Pattern.quote("\\\""), "\"");
string.replaceAll(Pattern.quote("\\\""), "\"");
replaceAll正規表現を取ります。したがって、次のようにエスケープをエスケープする必要があります。
replaceAll
s = s.replaceAll("\\\\\"", "\"");