title: Removing title content from page html
body: <p>Here I am creating preview for url. Which shows</p>
  
  <ol>
  <li>Url title</li>
  <li>Url description (title should not come in this)</li>
  </ol>
  
  <p>Here is my try. </p>
  
  <pre><code>&lt;?php
  function plaintext($html)
      {
          $plaintext = preg_replace('#([&lt;]title)(.*)([&lt;]/title[&gt;])#', ' ', $html);
  
          // remove title 
              //$plaintext = preg_match('#&lt;title&gt;(.*?)&lt;/title&gt;#', $html);
  
          // remove comments and any content found in the the comment area (strip_tags only removes the actual tags).
          $plaintext = preg_replace('#&lt;!--.*?--&gt;#s', '', $plaintext);
  
          // put a space between list items (strip_tags just removes the tags).
              $plaintext = preg_replace('#&lt;/li&gt;#', ' &lt;/li&gt;', $plaintext);     
  
              // remove all script and style tags
          $plaintext = preg_replace('#&lt;(script|style)\b[^&gt;]*&gt;(.*?)&lt;/(script|style)&gt;#is', "", $plaintext);
  
          // remove br tags (missed by strip_tags)
              $plaintext = preg_replace("#&lt;br[^&gt;]*?&gt;#", " ", $plaintext);
  
              // remove all remaining html
              $plaintext = strip_tags($plaintext);
  
          return $plaintext;
      }
          function get_title($html) 
      {
          return preg_match('!&lt;title&gt;(.*?)&lt;/title&gt;!i', $html, $matches) ? $matches[1] : '';
      }
          function trim_display($size,$string)
      {
          $trim_string = substr($string, 0, $size);
  
          $trim_string = $trim_string . "...";
          return $trim_string;
      }
  
  $url = "http://www.nextbigwhat.com/indian-startups/";
  $data = file_get_contents($url);
  //$url = trim_url(5,$url);      
      $title = get_title($data);
          echo "title is ; $title";   
      $content = plaintext($data); 
      $Preview = trim_display(100,$content);
  echo '&lt;br/&gt;';
  echo "preview is: $Preview";
  
  ?&gt;
  </code></pre>
  
  <p>URL title appear correctly. But when I have excluded the title content from description, even it appear.</p>
  
  <p>i have uses <code>$plaintext = preg_replace('#([&lt;]title)(.*)([&lt;]/title[&gt;])#', ' ', $html);</code> to exclude the title from plain text. </p>
  
  <p>Regex is correct as per me event it does not exclude title content.</p>
  
  <p>What is the problem here?</p>
  
  <p>output we get here is:</p>
  
  <pre><code>title is ; Indian Startups Archives - NextBigWhat.com
  preview is: Indian Startups Archives : NextBigWhat.com [whatever rest text]...
  </code></pre>
  
  <p>Actually the text which appears in title part should not again come in preview. That's why i want to exclude it and display rest text in preview.</p>