Convert HTML string to JavaScript text keeping indentation
问题 I want to target or match only the first occurrence per line Typical Scenario: I have an HTML Structure that I am using in JavaScript. <ul> <li> ABC </li> <li> DEF </li> <li> GHI <span> GHI-SPAAN </span> </li> </ul> To convert the above into a string, in my editor, I can simply Find & replace EOL with a '+ and beginning of line with a ' so that the code would be var tpl = ''+ '<ul> '+ '<li> ABC </li> '+ '<li> DEF </li> '+ '<li> GHI <span> GHI-SPAAN </span> </li> '+ '</ul> '; But you see, I