java手机号空格分割正则

1.手机号正则

String regex = "(1\w{2})(\w{4})(\w{4})";

String phone = phone.replaceAll (regex, "$1 $2 $3");

2.银行卡号正则,后四位显示

String regex ="^(\\w+)(\\w{4})$";

String carnumber = idCard.replaceAll (regex,"**** **** ****$2");

你可能感兴趣的:(java手机号空格分割正则)