lyuehh
3/28/2013 - 3:15 AM

gistfile1.txt

function parseHTMLToText(html) {
  if( html ){
    html = html.replace(/\n/g,"");
    html = html.replace(/<br \/>|<br>|<\/p>|<\/P>|<\/li>|<\/LI>/g,"\n"); //li special
    html = html.replace(/<[^>]+>/g,"");
    html = html.replace(/\t+/g, "");
    html = html.replace(/&nbsp;/g,"");
  }else{
    html = "";
  }
  return html;
}