[Java] Mask some part of String

Reference: [stackoverflow] Mask some part of String

return String.replaceAll("\\b(\\d{3})\\d+(\\d{3})", "$1****$2");  
# 1234567890 => 123****890
This entry was posted in Java. Bookmark the permalink.