Also, using regular expressions, I also abused these functions to do what you think you need to do (separate html and such from the text string):
function striptags(stringToStrip) {
return stringToStrip.replace(/(<([^>]+)>)/ig,"");
}
function trim(stringToTrim) {
return stringToTrim.replace(/^\s+|\s+$/g,"");
}
Incredible regular expressions that saved me a lot of time.
source
share