function escapeHtml(text) {
return text
.replace(/\t/g, "")
.replace(/\n/g, "")
.replace(/%/g,"")
.replace(/\s/g, " ")
.replace(/&/g, "")
.replace(/</g, "")
.replace(/>/g, "")
}
can somebody provide me the regex for all the above entities into a single regex?
'<div>something</div>' -> 'divsomething/div'\swith a space, instead of with an empty string like all the rest?\sis the same as space,\t, and\n. but you already replaced\tand\nearlier.