// 手机号码前三后四脱敏 String PHONE = listmap.get("PHONE")+""; if (StringUtils.isEmpty(PHONE) || (PHONE.length() != 11)) { listmap.put("PHONE", PHONE); }else { listmap.put("PHONE", PHONE.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")); } //身份证前三后四脱敏 String IDNO = listmap.get("IDNO")+""; if (StringUtils.isEmpty(IDNO) || (IDNO.length() < 8)) { listmap.put("IDNO", IDNO); }else { listmap.put("IDNO", IDNO.replaceAll("(?<=\\w{3})\\w(?=\\w{4})", "*")); }