How to remove special characters in the string except \"- _\". Now I use:
replaceAll(\"[^\\\\w\\\\s]\", \"\")
it remove all special charact
Use replaceAll("[^\\w\\s\\-_]", "");
replaceAll("[^\\w\\s\\-_]", "");
What I did was add the underscore and hyphen to the regular expression. I added a \\ before the hyphen because it also serves for specifying ranges: a-z means all letters between a and z. Escaping it with \\ makes sure it is treated as an hyphen.
\\
a-z