Regular expressions verify QQ numbers

Source: Internet
Author: User
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 stubString 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"); elseSystem. out. println ("incorrect QQ number ");}}

Regular expressions verify QQ numbers

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.