说我有
var string =
"<h1>Header</h1>
<p>this is a small paragraph</p>
<ul>
<li>list element 1.</li>
<li>list element 2.</li>
<li>list element 3. With a small update.</li>
</ul>"
//newlines for clarity only
如何使用 javascript 拆分此字符串以便得到
var array = string.split(/*...something here*/)
array = [
"<h1>Header</h1>",
"<p>this is a small paragraph</p>",
"<ul><li>list element 1.</li><li>list element 2.</li><li>list element 3. With a small update.</li></ul>"
]
我只想拆分顶部的 html 元素,而不是子元素。