Perl is magic

regexes are pure cancer. There's a reason why they're not used much anymore. Try writing one to validate an email address 100% accurately covering every edge case.

The main reason we abandoned Perl was its extreme autism about having a million different possible ways to solve a problem leading to a goddamn biblical tale of Babel trying to get multiple programmers to work together effectively. Since you're mostly disgusting millennials you didn't get to experience that, but you can live through it vicariously - try to add a feature to bugzilla that cuts across the codebase. Tour hell, in other words. And since you'll likely say something incredibly naive like, "but this situation was the fault of Perl programmers, not Perl!", know that we got tired of that bullshit excuse on every fucking Perl project and moved to a language where for whatever reason you're comfortable with it doesn't happen.

That's just not something you should use regexes for, because e-mail addresses are actually pretty complicated. They're at the edge of what a finite-state automaton can do.
That doesn't make regexes an invalid choice for all other tasks.

The problem with Perl is people mistaking it for a "real" programming language and using it for serious projects. Treat it like shell add-on, to, occasionally, enhance shell scripts, and it will serve you just fine.

They're quite simple, see page 29 of RFC 821. That's about 20 BNF rules. Only takes a couple minutes (with experience with the tools) to build a perfect validator with flex/bison. With regexes, it's likely impossible. Even a regex that gets close is essentially distilled madness.
There are almost no cases I've seen regexes used where they weren't an 80% solution. Email address validation, HTML header parsing, practically any use with UNIX utilities, etc.. Pick a program, grep for a regex, then see if you can come up with edge cases that break it. You might be surprised at how fragile they are in practice. It's better for correctness to just ban their use since they're almost never used well, and I've worked at several companies that do that.

Oh really? What do you use instead?

Haskell parser combinators.

Parser generators.

Full retard.jpg

There's a quick way, and a proper way for everything, Pajeet.