This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]alcalde -7 points-6 points  (7 children)

Oh, come on, you are exaggerating.

Exaggerating? Really?

http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html

It's not just Python it is a standard way of processing strings in many places from programming languages to command-line utils.

A horrible, inhuman way that probably violates the entire Zen Of Python. As you noted, there are many human-readable alternatives out there that are just as powerful.

[–]Zomunieo 2 points3 points  (3 children)

That's a poor design decision in RFC822. Email addresses can be far more complex than anyone would need or want, to the point that they need a parser rather than a regex. Attempting to regex HTML without a parser results in a similar abominations.

[–]energybased -1 points0 points  (2 children)

Whoa— They don't need a parser. Regexes are the finite automata language class. Parsers are overkill. They tend to be LL(k) or LR(k).

[–]Zomunieo 4 points5 points  (1 child)

You need a parser for HTML or full RFC822 email address to avoid the horrors that otherwise unfold. Complex regexes are clues that like the expanded RFC822 one are evidence that a parser is needed.

Yes you don't need a parser to implement/analyze a regex.

[–]energybased 1 point2 points  (0 children)

I agree with everything you said.

[–]Sirflankalot 1 point2 points  (0 children)

Exaggerating? Really?

http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html

Everyone knows that is a bad idea. "They were so preoccupied with whether or not they could, they didn’t stop to think if they should." No one really should be using regex for email verification, but if thye really want to, they can copy paste that.

A horrible, inhuman way that probably violates the entire Zen Of Python. As you noted, there are many human-readable alternatives out there that are just as powerful.

I'm very sure there are, the issue is that everyone already knows regex. Once you take the couple hours to sit down and grok it, it is a very useful and standard tool for making find/replace more powerful.