手机号脱敏
public class DataMaskingUtils{
//匹配规则
private static final String REGEX_OF_PHONE = "(^\\d{3})\\d.*(\\d{4}$)";
//替换规则
private static final String RRPLAGE_OF_PHONE = "$1****$2";
/**
* 手机号脱敏 153****8736
* @param phone
*/
public static Stirng phoneMasking(String phone){
if(!StringUtils.isEmpty(phone)){
return phone.replaceAll(REGEX_OF_PHONE, REPLACE_OF_PHONE);
}
return null;
}
}
身份证号脱敏
public class DataMaskingUtils{
//匹配规则
private static final Stirng REGEX_OF_ID=