As Esailija mentioned, this will not do anything for real security.
The code you mentioned is an almost negative set, since the mentioned murgatroid99, ^ is in parentheses. Thus, the regular expression will match what is not in this list. But it looks like you really want to remove these characters, so your regular expression does not need to be undone.
Your code should look like this:
str.replace(/[a-zA-Z0-9éèêëùüàâöïç\"\/\%\(\).'?!,@$#-_ \n\r]/g, "");
That says, remove all characters in my regex.
However, this means that you do not want to save a-zA-Z0-9 , are you sure you want to disable them?
Also, chrome is not like in regular expressions, you should use \x along with the hexadecimal code for the character
source share