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:
- Java uses regular expressions to intercept the contents between specified strings
- The method of removing special characters in ABAP
- A solution to automatically convert special characters into Unicode when taking out data from MySQL and encapsulating it into JSON
- Solution to the problem that some special characters in finereport cannot be displayed or displayed as question mark
- Curl returns empty reply from server. Due to the processing of special characters, curl cannot be accessed and the browser can access it.
- Solve the problem of using logback console to print log Chinese characters in IDEA as garbled characters
- Regular error in UDF java.lang.stackoverflowerror
- Java regular matching returns all matches
- Java String.split () special character processing
- hypercan Have unordered match in sub-expressions.
- Remove M Characters “Control M” or “^M” or “CTRL M” Characters in a UNIX file
- El expressions are not parsed and output as is
- SCP error: not a regular file
- Remove spaces after characters in Excel cells
- The solution cannot be separated due to a special separator
- Regular view interface consumes more than 4 digits
- Linux remote copy command and not a regular file solution
- The built-in filter function in Excel can’t contain all the items
- Basic use of filter
- Practice — CSS3 — frame animation to achieve special effects