Can someone provide a regular expression to search and replace illegal characters found
Example, removing �
I am not sure how many types of \'illegal\' char
Instead of having a blacklist, you could use a whitelist. e.g. If you want to only accept letters, numbers, space, and a few punctuation characters, you could do
myString.replace(/[^a-z0-9 ,.?!]/ig, '')