The regular expression verifies the QQ number and the regular expression number.
If you don't talk much about it, paste the Code directly. The specific code is as follows:
Package regular expression;/* verification requirements for QQ numbers 5 ~ 15 digits. It cannot start with 0 and can only be numbers */import java. util. regex. matcher; import java. util. regex. pattern; public class Test {public static void main (String [] args) {// TODO Auto-generated method stub String qq = "23412312 "; string regex = "[1-9] [0-9] {4, 14}"; // a number between the first digit and the second digit, the number range is 4-14. // String regex2 = "[1-9] \ d {4, 14}"; // This sentence can also be boolean flag = qq. matches (regex); if (flag) System. out. println ("correct QQ number"); else System. out. println ("Incorrect QQ number ");}}
The above is the regular expression introduced by the editor to verify the QQ number. I hope it will be helpful to you. If you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!