How did REGEX jaibreak from Compiler Technology and become popular with non-compilerists?
First guess: (1) grep, sed, awk, etc. broke the ice, and, (2) perl brought REGEX into the mainstream.
I guess that perl solved a latent problem, which made it very popular. What was that problem?
12/23/2022, 2:56 PM
I think part of the answer is that is that it’s representation as strings meant that it was supported by a near-ubiquitous infrastructure of plaintext which made it much easier to share, store, and use in everyday systems.
12/23/2022, 3:01 PM
The real question for me is why isn’t grep/regex search more commonly used by non-programmers?
12/23/2022, 3:05 PM
It's funny how all declarative syntaxes (syntaxii?) acquire a reputation for fiendishness! Take CSS - coulda been a non-programmer language but it's notoriously hard to do simple things like line stuff up; take SQL - a team at my work had the "SQL expert" who everyone went to cos it was so bloody hard, and of course, the most notorious of all: regexes - if only there were a non-brain-twisting way of doing them!
One part of that seems a bit off. The nice formalism is for regular expressions, which don’t support backreferences (one of the ways that modern “regexes” drifted from the original concept—towards more power, but more obscurity).
Combinators are neat, and I wish they were better integrated as an option that plays nicely with existing libraries. The downside is that they give up the very powerful idea of regular expressions as a language, instead of just another API for doing string processing.
As a result, they’re most powerful for programmers who rarely use regular expressions, and programmers who want to do certain more abstract manipulations of regular expressions, but weak for non-programmer end users, and programmers who routinely use regular expressions.
12/23/2022, 11:45 PM
Parsing is an essential part of any IO more complicated than accepting and echoing byte strings. Regex solves or helps solve parsing across a wide variety of problems. I think that answers why it "jailbroke" from "compilerists": it was never just a compiler thing, everyone needs parsing. Once someone figured out the math, something like regex was inevitable.
The question of Perl's adoption, and by extension PCRE, is IMO a separate one, more historical than theoretical. I assume it's the usual right-place-right-time/path-dependent/worse-is-better type of story. Certainly Perl is more than PCRE, and was responsive to more problems than just parsing.