Replace all double quotes within String

前端 未结 8 1232
轻奢々
轻奢々 2020-12-13 06:00

I am retrieving data from a database, where the field contains a String with HTML data. I want to replace all of the double quotes such that it can be used for parseJS

8条回答
  •  误落风尘
    2020-12-13 06:31

    The following regex will work for both:

      text = text.replaceAll("('|\")", "\\\\$1");
    

提交回复
热议问题