title: Trim string to length ignoring HTML
body: <p>This problem is a challenging one. Our application allows users to post news on the homepage. That news is input via a rich text editor which allows HTML. On the homepage we want to only display a truncated summary of the news item.</p>
  
  <blockquote>
    <p>For example, here is the full text we are displaying, including HTML</p>
    
    <p><br/>
    In an attempt to make a bit more space in the office, kitchen, I've pulled out all of the random mugs and put them onto the lunch room table. <strong>Unless you feel strongly about the ownership of that Cheyenne Courier mug from 1992 or perhaps that BC Tel Advanced Communications mug from 1997, they will be put in a box and donated to an office in more need of mugs than us.</strong>
    <br/></p>
  </blockquote>
  
  <p>We want to trim the news item to 250 characters, but exclude HTML.</p>
  
  <p>The method we are using for trimming currently includes the HTML, and this results in some news posts that are HTML heavy getting truncated considerably.</p>
  
  <p>For instance, if the above example included tons of HTML, it could potentially look like this:</p>
  
  <blockquote>
    <p>In an attempt to make a bit more space in the office, kitchen, I've pulled...</p>
  </blockquote>
  
  <p>This is not what we want. </p>
  
  <p>Does anyone have a way of tokenizing HTML tags in order to maintain position in the string, perform a length check and/or trim on the string, and restore the HTML inside the string at its old location?</p>