如何在字符串中转义双引号
***注意:***此解决方案不处理已正确转义的双引号,也不能正确转义反斜杠。但它仍可作为自定义转义的起点。
how-to-escape-double-quotes-in-stirng.js
'foo"bar"gas'.replace(/"/g, "\\\"") # 结果为 foo\"bar\"gasCheck out similar posts by category:
Javascript
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow