Do you understand regular expressions in this way? the regular expressions written by others are as follows:
If (! Preg_match ('/^ [\ w \-\.] + @ [\ w \-\.] + (\. \ w +) + $/', $ _ string ))
I understand the brackets and their meanings as follows: Brackets indicate any of them;
Then, [\ w \-\.] in the above section can be understood as the first one that can be followed by any English character, horizontal bar, or dot.
If the above understanding is correct, the problem arises. the purpose of this code is to verify the correctness of the email.
We all know that the first hit in an email cannot be a horizontal bar. isn't that wrong?
Reply to discussion (solution)
Nowadays, many email verification methods are rough, because some service providers do support odd writing. I think it is better to miss the network and avoid mistakes.
Attaches a dropbox foreign website with the source code verified by email:
$r = preg_match('/^[A-Za-z0-9!#$%&\'*+\/=?^_`{|}~-]+(\.[A-Za-z0-9!#$%&\'*+\/=?^_`{|}~-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.([A-Za-z]{2,})$/', $email);
Nowadays, many email verification methods are rough, because some service providers do support odd writing. I think it is better to miss the network and avoid mistakes.
Attaches a dropbox foreign website with the source code verified by email:
$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 are two! I am asking about my understanding, right?
Your regular expression can match... @ ....Net
Are you right?
Nowadays, many email verification methods are rough, because some service providers do support odd writing. I think it is better to miss the network and avoid mistakes.
Attaches a dropbox foreign website with the source code verified by email:
$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 are two! I am asking about my understanding, right?
Your attitude is doomed to your development.
\ W uppercase/lowercase English letters, numbers, and underscores
This regular expression matches. @... _ @ _. _-@--. 0 .....
Regular expression problems
Understanding is okay, and attitude is wrong.
Fuck you, there's a problem