Node.js examples for String:String Value
Removes all the scripts declarations out of the string
/**/*from www. jav a 2s . c o m*/ * removes all the scripts declarations out of the string * @param mixed option. If it equals true the scrips will be executed, * if a function the scripts will be passed in it * @return String without scripts */ stripScripts: function(option) { var scripts = '', text = this.replace( /<script[^>]*>([\s\S]*?)<\/script>/img, function(match, source) { scripts += source + "\n"; return ''; } ); if (option === true) { $eval(scripts); } else if (isFunction(option)) { option(scripts, text); } return text; },