title: PHP regular expression : match the closest one
body: <p>I have a string like this</p>
  
  <pre><code>&lt;div&gt;&lt;span style=""&gt;toto&lt;/span&gt; some character &lt;span&gt;toto2&lt;/span&gt;&lt;/div&gt;
  </code></pre>
  
  <p>My regex:</p>
  
  <pre><code>/(&lt;span .*&gt;)(.*)(&lt;\/span&gt;)/
  </code></pre>
  
  <p>I used preg_match and it returns the entire string</p>
  
  <pre><code>&lt;span style=""&gt;toto&lt;/span&gt; some character &lt;span&gt;toto2&lt;/span&gt;
  </code></pre>
  
  <p>I want it returns:</p>
  
  <pre><code>&lt;span style=""&gt;toto&lt;/span&gt;
  and
  &lt;span&gt;toto2&lt;/span&gt;
  </code></pre>
  
  <p>What do I need to do to achieve this? Thanks.</p>