I have a string like this in PHP
<li>bla bla bla bla</li>
<li>hello hello</li>
<li>the brown fox didnt jump</li>
.
.
.
<li>aaaaaaarghhhh</li>
I want to get a string wich contains the first X li's (li tags included in the result string)
<li>.....first one....</li>
<li>.....second one....</li>
<li>.................</li>
<li>.....X one....</li>
How can this be done with REGEX or something else????
I could remove the
</li>
then explode by
<li>
and get the first X elements of array and then adding again li tags at beginning and at end of each element, but i think its too dirty...
Any better ideas?