title: PHP preg_replace crashes. Only for Regexp Masters
body: <p>How are you? I'll get straight to the point.</p>
  
  <p>I'm using a <strong>recursive regular expression</strong> that basically <strong>removes individual or nested &lt;blockquote> tags</strong>. I only need to remove plain &lt;blockquote> ... &lt;/blockquote> text, nested or not, and leave whatever is outside of these.</p>
  
  <p>This regex does the job EXACTLY as I want (note the use of lookahead and recursion)</p>
  
  <pre><code>$comment=preg_replace('#&lt;blockquote&gt;((?!(&lt;/?blockquote&gt;)).|(?R))*&lt;/blockquote&gt;#s',"",$comment);
  </code></pre>
  
  <p>but it has a big problem: <strong>when the $comment is large (more than 3500 characters long), apache crashes</strong> (I assume segmentation fault).</p>
  
  <p>I need a solution to the problem, either but <strong>solving the crash</strong>, using a <strong>better regexp</strong> or a <strong>custom function</strong> that will do the job as well.</p>
  
  <p>If you simply have ideas on how to remove nested specific tags, they are kindly welcome.</p>
  
  <p>Thank you in advance</p>