title: REGEX match x times "<li> anything in here </li>"
body: <p>I have a string like this in PHP</p>
  
  <pre><code>&lt;li&gt;bla bla bla bla&lt;/li&gt;
  &lt;li&gt;hello hello&lt;/li&gt;
  &lt;li&gt;the brown fox didnt jump&lt;/li&gt;
  .
  .
  .
  &lt;li&gt;aaaaaaarghhhh&lt;/li&gt;
  </code></pre>
  
  <p>I want to get a string wich contains the first X li's  (li tags included in the result string)   </p>
  
  <pre><code>&lt;li&gt;.....first one....&lt;/li&gt;
  &lt;li&gt;.....second one....&lt;/li&gt;
  &lt;li&gt;.................&lt;/li&gt;
  &lt;li&gt;.....X one....&lt;/li&gt;
  </code></pre>
  
  <p>How can this be done with REGEX or something else????</p>
  
  <p>I could remove the </p>
  
  <pre><code>&lt;/li&gt;
  </code></pre>
  
  <p>then explode by </p>
  
  <pre><code>&lt;li&gt;
  </code></pre>
  
  <p>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...</p>
  
  <p>Any better ideas?</p>