Forum e-Mail positive regular expression upgrade

Source: Internet
Author: User
Is today got the legend has 1G big Gmai, really very easy to use very fast, without the traditional collection folder, take the generation of the labels, the user set up their own labels after the addition of mail filtering settings, became the automatic Mail division training function, logically, User name +labels@gmail.com, "labels" can name themselves, can reach countless e-mail address, these addresses also point to the user name @gmail.com

I was outside testing: can over 163 mailboxes to the user name +labels@gmail.com, mail normal arrival, and in accordance with the prior to the worry-setting is automatically categorized into the labels folder (in fact, not a folder). In other words, the traditional e-mail address does not allow the "+" rule has been broken, so many delete the process of e-mail verification also need to update.

These days I have read. NET, the following is a modified email verification of the regular expression:


Legal e-mail address:
1. Must contain one and only one symbol "@"
2. The first character must not be "@" or "."
3. "@." is not allowed to appear. Or. @
4. The end must not be the character "@" or "."
5. Allow "+" to appear in the characters before "@"
6. Do not allow "+" at the front, or "+@"

The regular expression is as follows:
-----------------------------------------------------------------------
^ (\w+ (-\w+) | ( \.\w+)) \+\w+ (-\w+) | ( \.\w+)) *\@[a-za-z0-9]+ (\.| -) [a-za-z0-9]+) *\. [a-za-z0-9]+$
-----------------------------------------------------------------------

Character Description:
^: matches the start position of the input.
\: Marks the next character as a special character or literal.
*: Matches the previous character 0 times or several times.
+: Matches the previous character one or more times.
(pattern) matches patterns and remembers matches.
X|y: Matches x or Y.
[A-Z]: represents a range of characters. Matches any character within the specified interval.
\w: Matches any word characters, including underscores.
$: Matches the end of the input.



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.