On 12/28/20 8:02 PM, Chris Angelico wrote: > > Yes, many such regexes exist, and they are *all wrong*. Without > exception. I don't think it's actually possible for a regex to > perfectly match all (syntactically) valid email addresses and nothing > else. > > ChrisA
Since Email addresses are allowed to have (comments) in them, and comments are allowed to nest, I think it takes something stronger than a regex to fully process them, but takes something that can handle a recursive grammar. I think that is the only thing that absolutely prevents using a regex (but not sure about it) but some of the rules will make things messy and need to use alternation and repetition. The one other thing that might block a regex is I think there is an upper limits to how long the address (or its parts) are allowed to be, and testing that at the same time as the other patterns is probably beyond what a regex could handle. -- Richard Damon -- https://mail.python.org/mailman/listinfo/python-list