I want to convert html of this kind:
<h2>heading1</h2>
something1
<h2>heading2</h2>
something2
...
to
<li>
<div class="a">
heading1
</div>
<div class="b">
something1
</div>
</li>
<li>
<div class="a">
heading2
</div>
<div class="b">
something2
</div>
</li>
...
I think there should be some proper regexp (in PHP) for this job.
I tried /<h2>(.*?)<\/h2>(.*?)(<h2>)?/s
but that doesn't work.
)?` if present is consumed already making it impossible to match the subsequent `
– Jonny 5 Jul 10 '15 at 12:32`. Using a [lookahead](http://www.regular-expressions.info/lookaround.html) `(?=`...