I'm sure this question has been asked before, but I'm unable to find it.
I have a bunch of list elements like so:
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
<br><br>
sample text
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
more text
<li class="list-item">aewfaffjpiowfj: apeifjeawpfioj</li>
I want to wrap each group in a <ul></ul>
element. How do I do that?
This is what I've tried, but it only matches the individual elements:
/<li [^>]*>.*<\/li>/g
https://regex101.com/r/KXEkJz/1
And if I do /<li [^>]*>[\s\S]*<\/li>/g
, it produces one giant match.
`. Do you consider them a group if there is only one line break between them? What makes it a group?
– snollygolly Jun 20 '17 at 01:29