Today, I saw someone in the forum to ask how to do the mobile phone number. In fact, the regular expression library with JDK himself can be well solved. Here is the shielding program I wrote: import java.util.Regex. *;
Public class replacestel {public static void main (string [] args) throws exception {pattern p = pattern.compile ("13 [0-9] {9}"); matcher m = p.matcher ("Your tel is: 13331239924 But my is 13347215555 "); String Result = m.replaceAll (" xxxxxxxxxxx ") System.out.println (Result);}}