Regular expression shielding mobile phone number

xiaoxiao2021-03-06  44

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);}}

转载请注明原文地址:https://www.9cbs.com/read-53851.html

New Post(0)