Python Regular Expressions determine whether the mailbox format is correct. python Regular Expressions
Import re
Def validateEmail (email ):
If len (email)> 7:
If re. match ("^. + \\@(\\[?) [A-zA-Z0-9 \-\.] + \. ([a-zA-Z] {2, 3} | [0-9] {1, 3}) (\]?) $ ", Email )! = None:
Return 1
Return 0
How does Python determine whether regular expressions match successfully?
If the matching fails, None is returned. If the matching succeeds, a successful matching object is returned.
For example:
If pat. match ('A ')
Print 'match'
If 'A' is matched, match is output. Otherwise, if conditions are not true, nothing is output.
Do not use = 'none'. None is False.
Direct
If s:
Print 1 # matching successful
Else:
Print 2 # matching failed
Write a regular expression that verifies the correctness of the email address format and explains the meaning of the regular expression. The answer is quick and urgent !!!
Write in JS like this
Var CheckMail =/^ ([a-zA-Z0-9 _-]) + @ ([a-zA-Z0-9 _-]) + (. [a-zA-Z0-9 _-]) + /;
Var email = document. getElementById ("email ");
If (! CheckMail. test (email ))
{
Alert ("Incorrect email format! "); Return false;
}
I really don't want to talk about regular expressions. I can only understand what I said!