List of utility methods to do String Sanitize
sanitize()String.prototype.sanitize = function() { return $('<div/>').text(this).html(); }; | |
sanitize()String.prototype.sanitize = function(){ return this.replace(/</g, '<').replace(/>/g, '>'); | |
sanitize()String.prototype.sanitize = function() { return this .replace(/&/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"') .replace(/'/g, ''') | |
sanitize()String.prototype.sanitize = function () { var str = this.replace(/<[^>]*?>/g, ''); return str; }; | |
sanitizeSpacing()"use strict"; String.prototype.sanitizeSpacing = function () { return this .replace(/[\t\r\n\-]/g, ' ') .replace(/ +/g, ' ') .trim(); }; | |
sanitizeToId()String.prototype.sanitizeToId = function () { return this.replace(/\]/g, '').replace(/[^-a-zA-Z0-9:.]/g, '_'); }; |