Home >Backend Development >PHP Tutorial >Regular expression to verify email and phone number

Regular expression to verify email and phone number

WBOY
WBOYOriginal
2016-07-25 09:13:08933browse

Regular for verifying phone numbers: (d{3}-)(d{8})$|(d{4}-)(d{7})$|(d{4}-)(d{8) })$

     (The phone number here is a new type of number)

Verification of email address: w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*

    wAny uppercase and lowercase English letters, 0-9 numbers, underscores + means at least one character appears
    [-+.]w+ Any combination of - + . and w characters appears 0 or more times

   @ Fixed symbol

    w+ The character w appears at least 1 time or more
    [-.]w+ The character that appears zero or more times in this combination

    . Fixed symbol

     Anyway, w+([-.]w+)* This combination is stipulated to start with a w type character, and then followed by w and a combination of - dash and period

Regular verification of email The whole sentence means

     Email address must start with uppercase and lowercase letters or numbers or underscores,

                                                                                        English period

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn