Skip to content

Instantly share code, notes, and snippets.

@tracend
Created January 15, 2014 08:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tracend/8432474 to your computer and use it in GitHub Desktop.
Save tracend/8432474 to your computer and use it in GitHub Desktop.
striptags() #handlebars #helper #cc
Handlebars.registerHelper("striptags", function( txt ){
// exit now if text is undefined
if(typeof txt == "undefined") return;
// the regular expresion
var regexp = new RegExp('#([^\\s]*)','g');
// replacing the text
return txt.replace(regexp, '');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment