Regular expressions validate mailboxes, phone numbers

Source: Internet
Author: User

Verify the phone number's regular: (\d{3}-) (\d{8}) $| (\d{4}-) (\d{7}) $| (\d{4}-) (\d{8}) $

(The phone number here is a modern number)

Verify the regular mailbox:\w+ ([-+.] \w+) *@\w+ ([-.] \w+) *\.\w+ ([-.] \w+) *

\w any case English letter 0-9 digit underline + to appear at least 1 characters
[-+.] \w+ any containing-+. And the combination of \w characters appears 0 or more times

@ Fixed Symbol

\w+ at least 1 occurrences of \w characters
[-.] \w+ appears 0 or more times this combination of characters

\. Fixed symbol

Anyway \w+ ([-.] \w+) * This combination is required to start with the \w type character, followed by the \w and-underline. The combination of the dot number

The regular validation of the mailbox means that the whole sentence

The email address must start with uppercase or lowercase letters or numbers or underscores.

After that, you can follow any \w character and an underscore plus sign in English, followed by any \w character and the underlined plus sign in the English period . Keep up with any of the \w characters and the underlined plus sign English period

  • Related Article

    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.