我就是懒的要命
程序员文章站
2022-07-16 09:20:58
...
手机号隐藏:187****7456
public static String replacePhoneNumber(String rawPhoneNumber) {
final String replacement = "$1****$3";
return rawPhoneNumber.replaceAll("(\\d{3})([^<>]*)(\\d{4})", replacement);
}