Regular expressions filter special characters

 String regEx="[`~!@#$%^&*()_\\-+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";  
        Pattern   p   =   Pattern.compile(regEx);     
        Matcher   m   =   p.matcher(searchKeyWord);     
        searchKeyWord =  m.replaceAll("").trim(); 

matches Chinese, regular expression: [\u4E00-\u9FA5] because the range of Chinese unicode code is this.

matches Numbers, [0-9 b|.] this matches integers and decimals.

matches English letters, [a-z| a-z] matches upper and lower case English characters.

whitespace characters, [\s] may need to be written [\\s] in the program so that \r,\n,\t,space, and other whitespace characters can match, instead of whitespace characters just adding a ^, write: [^\\s]

Read More: