I have a list of special characters that I want removed from strings, the list is as follows: (separated by space)
! % & \ ' ( ) * + - . / ; < = > ? \\ , : # @ \t \r \n " [] _
I was trying to to my replace function like this, but I ran into trouble with characters like //, \t, \r, \n and []
var input = 'test ! % & \ ' ( ) * + - . / ; < = > ? \\ , : # @ \t \r \n " [] _ test';
input.replace(/[!%&\'()*+-./;<=>?\\,:#@\t\r\n"[]_][\u007B-\u00BF]/g, "");
Is there a better way to correctly do this? Or is it possible to use an array as restricted characters somehow?
 
     
     
     
    