How to remove special characters in the string except \"- _\". Now I use:
replaceAll(\"[^\\\\w\\\\s]\", \"\")
it remove all special charact
String str="owl@134_- abc"; String s=str.replaceAll(" [^a-zA-Z_-]+ ", ""); System.out.println(str);
It will replace the special character and white spaces from a given string.
Output will be: owlabc_-
owlabc_-