用Java正则替换手机号中间4位数

public class Mobile {
    public static void main(String[] args) {
        String mobile = "136****7423";
        mobile = mobile.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
        System.out.println(mobile);
    }
}

 

You haven't logged in yetLogin OrRegisterAdd comments after
Popular Articles
Popular Tags
Java(22)
Recently published