Hacker News new | ask | show | jobs
by bcrosby95 1415 days ago
My biggest problem with regex is each language/program/whatever has their own take on it. You don't have to learn it over and over, you have to learn multiple slightly different versions of it over and over.
3 comments

I don't mind the slightly different versions, that's what documentation and SO is for. I mind the language being a garbage kludge of organically-grown syntax and semantics, with not the slightest hint of a single principle or a unifying idea. And I mind that the vast majority of interfaces to it from a general purpose PL is fucking around with strings like a caveman, instead of a typed, IDE-assisted, first-class representation as a full-blown language construct or mix of constructs
From this description, you may enjoy Raku.
been recently learning Python in earnest. Coming from Perl, Ruby, PHP, JavaScript, etc. I'm just dumbfounded. How on earth did Python's regex library get to be so bad? It's like it was designed by people that were figuring out how regexes worked as they went along but must have skipped the part about modifiers, how anchoring works, etc. No wonder so many people hate regexes. The ironic part is Python's "one obvious way to do it" zen thing. It has like 5 different ways to do the same thing with a regex whereas Perl, the "more than one way to do it" camp has simple and obvious ways to do everything with regex. I love regex in Perl. In Python I don't want to touch it ever again. Even JavaScript is miles better.
I agree. I actually have a pretty strong understanding of regexes and use them regularly (for editing, not so much in code), but I despise how every editor/language does them subtly different.