Go regular expressions achieve the same effect with Python

there are two serial services, one written by go and the other written by Python.
use regular verification email address, found that the results of the two code verification are not consistent, and now want to unify the verification effect. Regular expression: (govalidatirs) in
go

Email          string = "^(((([a-zA-Z]|\\d|[!-sharp\\$%&"\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!-sharp\\$%&"\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$"

I hope Python can achieve the same verification effect (you can"t change the go code or cancel the verification)

is there any way to achieve regular translation? it is not possible to use the above expression directly


"^(((([a-zA-Z]|\d|[!-sharp\$%&'\*\+\-\/=\?\^_`{\|}~]|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])+(\.([a-zA-Z]|\d|[!-sharp\$%&'\*\+\-\/=\?\^_`{\|}~]|[\x00A0-\xD7FF\xF900-\xFDCF}\xFDF0}-\xFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])|(\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-zA-Z]|\d|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])|(([a-zA-Z]|\d|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])([a-zA-Z]|\d|-|\.|_|~|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])*([a-zA-Z]|\d|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])))\.)+(([a-zA-Z]|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])|(([a-zA-Z]|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])([a-zA-Z]|\d|-|_|~|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])*([a-zA-Z]|[\x00A0-\xD7FF\xF900-\xFDCF\xFDF0-\xFFEF])))\.?$"

python uses this, which is modified according to your go, and the effect is the same. But the actual verification mailbox does not need to be so complicated


Direct Baidu python implements the rules of mailbox verification. Find more versions to compare and verify

Menu