So you understand the regular, right?

Source: Internet
Author: User
See others write the regular is as follows:
if (!preg_match ('/^[\w\-\. +@[\w\-\.] + (\.\w+) +$/', $_string))
In the middle brackets and inside of the understanding, I am like this: the brackets denote any one of them;
Well, it [\w\-\] in the above paragraph. I understand that the first one in the front can be any English characters, or bars, or dots.

If the above understanding is correct, then the problem comes, this code is to verify the correctness of the email.
People know that the first e-mail can not be a horizontal bar, this is wrong?


Reply to discussion (solution)

Many mailbox checks are now rough checks, because some providers do support weird writing. I think it would be better to slip through, not to catch, and not to be used by users.
Attached to a Dropbox foreign website, email authentication source code:

$r = Preg_match ('/^[a-za-z0-9!#$%&\ ' *+\/=?^_ ' {|} ~-]+(\. [a-za-z0-9!#$%&\ ' *+\/=?^_ ' {|} ~-]+) *@[a-za-z0-9-]+ (\.[ a-za-z0-9-]+) *\. ([A-za-z]{2,}) $/', $email);

Many mailbox checks are now rough checks, because some providers do support weird writing. I think it would be better to slip through, not to catch, and not to be used by users.
Attached to a Dropbox foreign website, email authentication source code:

$r = Preg_match ('/^[a-za-z0-9!#$%&\ ' *+\/=?^_ ' {|} ~-]+(\. [a-za-z0-9!#$%&\ ' *+\/=?^_ ' {|} ~-]+) *@[a-za-z0-9-]+ (\.[ a-za-z0-9-]+) *\. ([A-za-z]{2,}) $/', $email);


You two, irrelevant! What I'm asking is my understanding, right, you two?

Your regular can match ... @....net
You're right, aren't you?


Many mailbox checks are now rough checks, because some providers do support weird writing. I think it would be better to slip through, not to catch, and not to be used by users.
Attached to a Dropbox foreign website, email authentication source code:

$r = Preg_match ('/^[a-za-z0-9!#$%&\ ' *+\/=?^_ ' {|} ~-]+(\. [a-za-z0-9!#$%&\ ' *+\/=?^_ ' {|} ~-]+) *@[a-za-z0-9-]+ (\.[ a-za-z0-9-]+) *\. ([A-za-z]{2,}) $/', $email);


You two, irrelevant! What I'm asking is my understanding, right, you two?



Your attitude is destined for your development.

\w uppercase and lowercase letters, numbers, underscores
This can be matched to. @. __ _@_._-@-.0 .....
There is a problem with the regular

Understanding is no problem, attitude is a problem.

There's something wrong with your mother.

  • 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.