title: Finding *two* html tags with Regular Expressions
body: <p>I need to pull out the content out of two paragraph tags and break it with a <code>&lt;br /&gt;</code> tag. The input is like so</p>
  
  <pre><code>&lt;p&gt;
  Yay
  &lt;/p&gt;
  &lt;p&gt;
  StackOverFlow
  &lt;/p&gt;
  </code></pre>
  
  <p>It needs to be like</p>
  
  <pre><code>&lt;p&gt;
  Yay &lt;br /&gt;
  StackOverflow
  &lt;/p&gt;
  </code></pre>
  
  <p>What I have so far is <code>&lt;p&gt;&lt;?php  preg_match('/&lt;p&gt;(.*)&lt;\/p&gt;/', $content, $match); echo($match[1])."..."; ?&gt;&lt;/p&gt;</code> Which pulls the first paragraph tag only:</p>
  
  <pre><code>&lt;p&gt;
  Yay...
  &lt;/p&gt;
  </code></pre>
  
  <p>Also, is it possible to set a character limit? A max of 40 characters for example from both of the paragraphs or would I have to use <code>substr</code>?</p>
  
  <p>Thanks!</p>
  
  <p>So it turned out to be:</p>
  
  <pre><code>&lt;?php $content = preg_replace('/&lt;\/p&gt;\s*&lt;p&gt;/', '&lt;br/&gt;', $content);  echo substr("$content",0,180)."..."; ?&gt;
  </code></pre>