I am trying to write a Java Script function that should enclose all the special characters in the given String in a bracket like following -
Input ===> Output
123@#$, ====> 123[@][#][$][,]
Changing All the special characters to certain String [ _ in this case] is easy -
string = string.replace(/[^a-zA-Z0-9]/g,'_');