Hacker News new | ask | show | jobs
by PhasmaFelis 3489 days ago
Why should the majority of people know regex? It sacrifices all clarity for extreme compactness, and the vast majority of users don't need its power. I'd love to see more powerful, versatile searches generally available--booleans, date ranges, so on and so forth--but regex is ridiculous overkill for most people's use cases.

I think this is one of the major stumbling blocks for computer literacy efforts--too many proponents define "literacy" not as "useful, applicable skills" but "the exact tools that I'm familiar with, and nothing else." Elsewhere in this thread there's people saying that command line skills are necessary to understand concepts like "files" and "programs".

2 comments

> I'd love to see more powerful, versatile searches generally available--booleans, date ranges, so on and so forth--but regex is ridiculous overkill for most people's use cases.

To do that you're going to reinvent regex, usually with a clunkier interface that has to be re-implemented everywhere. Or you'll come up with a text based system like google, which is again it's own domain specific language.

Edit - in fact, I just remembered we have such a tool where I work. Because the support folks were deemed to be too stupid to learn regex we created a custom "language" that turned out to be a bastardized, dumbed down version of them. Instead of the support staff learning a skill for life, they only learn our abomination.

> Or you'll come up with a text based system like google, which is again it's own domain specific language.

I was thinking of Google's system specifically, yes.

I use regex a lot. It's extremely powerful, and when you really need it then nothing else will do. It's also phenomenally obtuse, it takes a real time investment to become fluent in it, and 95% of users will never need its power.

People aren't ignorant of regex because they're stupid or uneducated. They're ignorant of regex because they don't need it. They wouldn't use it if they had access to it, because they have better things to do with their time. They'll get more done if you give them a tool whose power-to-usability balance is actually suited to their needs.

Regarding your support staff, perhaps they did in fact need regex despite that decision, or perhaps your custom language was not the right choice for their needs. That doesn't mean that the typical user has any use for regex.

To make matters worse, most programmers don't really know regex well enough to use it without reference, and even if they think they do, they probably don't know the problem domain or the nature of their regex to get it bug-free. See basically all attempts at parsing email addresses in regex for an example of this.

Then you have the gotchas... E.g. most implementations have performance issues in many scenarios, leading to situations like when SO went down a few months ago.