Created
March 28, 2013 03:15
-
-
Save lyuehh/5260274 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(/ /g,""); | |
}else{ | |
html = ""; | |
} | |
return html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment