javascript - js regex escaping quotes -


I want to avoid all the quotes that are text H1:

  H1: "text here"  

should be created:

  H1: & amp; Quot; Text & amp; Quot;  

It will be easy to see, but it is not in JS.

Something I tried:

  .replace (/ H1: (. *) (") (. *) / Ig," H1: $ 1 & amp; Quot; $ 2 ")  

In addition, it should work on other similar text: H1:" "Text here" "H1:" Text "here "H1:" "Text here"

First I split the string into lines. Then I only substitute the text on the right lines, and as long as I substitute the text, I combine all the lines together again:

   

Comments