String str = “dbasipo32fd次贷危机哦???————===0=sd-={}[]()(!@¥#……%&……*())——)”;
String result = str.replaceAll("[\u4e00-\u9fa5]","");//中文
result = result.replaceAll("[0-9]","");//数字
result = result.replaceAll("[a-zA-Z]","");//英文字母
result = result.replaceAll("[+]","");//+号
result = result.replaceAll("[-]","");
result = result.replaceAll("[#]","");
result = result.replaceAll("[_]","");
result = result.replaceAll("[.]","");
result = result.replaceAll("[;]","");
result = result.replaceAll("[\\[]","");
result = result.replaceAll("[\\]]","");
result = result.replaceAll("[(]","");
result = result.replaceAll("[)]","");
result = result.replaceAll("[ ]","");
result = result.replaceAll("[≠]","");
java中使用正则表达式
最新推荐文章于 2024-08-05 03:50:00 发布