Removes HTML tags and space characters, numbers and punctuation - Node.js String

Node.js examples for String:HTML String

Description

Removes HTML tags and space characters, numbers and punctuation

Demo Code


/**/*ww w  . j  a  v  a 2  s .  c  o m*/
* Removes HTML tags and space characters, numbers and punctuation.
* @param value Value being stripped.
* @return {*}
*/
stripHtml: function(value) {
   return value.replace(/<.[^<>]*?>/g, ' ').replace(/&nbsp;|&#160;/gi, ' ')
          .replace(/[0-9.(),;:!?%#$'"_+=\/-]*/g, '');
}

Related Tutorials