String regEx="[\n`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}[]‘::”“’., .?]"; //可以在中括号内加上任何想要替换的字符,实际上是一个正则表达式 String aa = " ";//这里是将特殊字符换为aa字符串," "代表直接去掉 Pattern p = Pattern.compile(regEx); Matcher m = p
mysql 去除特殊字符 update table set field = replace(replace(replace(field,char(9),''),char(10),''),char(13),''); mysql 去除前后空白字符 update table set field = TRIM(field); 将table 和 field 换成自己的表和字段即可