|
|
@@ -11,6 +11,7 @@ public class RegexpUtils {
|
|
|
private static final String CN_MOBILE_EXP = "^((13[0-9])|(15[0-3, 5-9])|(18[0,2,3,5-9])|(17[0-8])|(147))\\d{8}$";
|
|
|
private static final String HK_MOBILE_EXP = "^(5|6|8|9)\\d{7}$";
|
|
|
private static final String EMAIL_EXP = "^\\w+([-.]\\w+)*@\\w+([-]\\w+)*\\.(\\w+([-]\\w+)*\\.)*[a-z]{2,4}$";
|
|
|
+ private static final String SPECCHARACTER_EXP = "[\\\\s~·`!!@#¥$%^……&*(())\\\\-——\\\\-_=+【\\\\[\\\\]】{{}}\\\\|、\\\\\\\\;;::‘'“”\\\",,《<。.》>、/??]";
|
|
|
|
|
|
/**
|
|
|
* 匹配手机号码
|
|
|
@@ -55,4 +56,9 @@ public class RegexpUtils {
|
|
|
return m.matches();
|
|
|
}
|
|
|
|
|
|
+ public static String replaceSpecCharacter(String str){
|
|
|
+ Pattern p = Pattern.compile(SPECCHARACTER_EXP);
|
|
|
+ Matcher m = p.matcher(str);
|
|
|
+ return m.replaceAll("");
|
|
|
+ }
|
|
|
}
|