Perfect Email verification Regular Expression

Source: Internet
Author: User

The domain name format is as follows:
A domain name is composed of a specific character set, English letters, numbers, and "-" (that is, a hyphen or minus sign) of Chinese Characters in different countries, but cannot start or end with "-". "-" cannot appear consecutively. The domain name is case-insensitive. The domain name can contain up to 60 bytes (including the suffix. com,. net, and. org ).

/^ [A-z] ([a-z0-9] * [-_]? [A-z0-9] +) * @ ([a-z0-9] * [-_]? [A-z0-9] +) + [\.] [a-z] {2, 3} ([\.] [a-z] {2 })? $/I;

/Content/I forms a case-insensitive regular expression;
^ Match starts
$ Match ended
[A-z] the e-mail prefix must start with an English letter

([A-z0-9] * [-_]? [A-z0-9] +) * and _ a_2, aaa11, _ 1_a_2 match, and a1 _, aaff_33a _, a _ aa does not match, if it is a null character, but also match, * Indicates 0 or more.
* Indicates 0 or more characters.
[A-z0-9] * matches 0 or more English letters or numbers
[-_]? Match 0 or 1 "-" because "-" cannot appear continuously
[A-z0-9] + matches one or more English letters or numbers because '-' cannot end

@ There must be @
([A-z0-9] * [-_]? [A-z0-9] +) + see above ([a-z0-9] * [-_]? [A-z0-9] +) * interpreted, but cannot be empty, + represents one or more.
[\.] Treats special characters (.) as common characters
[A-z] {2, 3} matches two to three English letters, generally com or net.
([\.] [A-z] {2 })? Match 0 or 1 [\.] [a-z] {2} (for example. cn, etc.) I do not know whether the last part of .com.cn is generally two. If not, Change {2} to {start word count, End Word Count}

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.