<div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif">If that's really true, that you learned from Spencer's library, then you didn't learn the most important thing about them, which is the automata theory that guarantees their performance is always linear. Not to take anything away from Henry, who admitted at the time that it could be slow for bad expressions, but we're still paying the price for refusing to connect "regex" with the theory that created them, ignoring it in fact.</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">Background: <a href="https://swtch.com/~rsc/regexp/regexp1.html">https://swtch.com/~rsc/regexp/regexp1.html</a></div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,sans-serif">-rob</div><div class="gmail_default" style="font-family:arial,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 4, 2024 at 2:38 PM Larry McVoy <<a href="mailto:lm@mcvoy.com">lm@mcvoy.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Marc is right.  I'll add that I grew up in terminal rooms, a bunch of<br>
kids connected to a VAX 780, like 40 or more.  I have no idea how the<br>
kids ahead of me learned but I learned by looking at their terminal<br>
and going "what did you just do?".<br>
<br>
My real understanding of regex is from Henry Spencer's regex.<br>
<br>
On Sun, Mar 03, 2024 at 07:03:39PM -0700, Marc Rochkind wrote:<br>
> Will, here's my recollection, when I got to UNIX in late 1972 or<br>
> thereabouts:<br>
> <br>
> First, there was ed. grep and sed were derived from ed, so came along<br>
> later. awk came along way later.<br>
> <br>
> There were only manual pages. You typed "man ed" and there it was. The man<br>
> pages were very accurate, very clear, and very authoritative. Many found<br>
> them too succinct, especially as UNIX got more popular, but all of us back<br>
> in the day found them perfect. Maybe you had to read the man page a few<br>
> times to understand it, but at least that's all you had to read. No need to<br>
> hunt around for more documentation!<br>
> <br>
> (Well, there was more documentation: The source code, which was all online.<br>
> But reading the ed source to understand regular expressions was impossible.<br>
> It was in assembler, and Ken was generating code on the fly as the<br>
> expression was compiled.)<br>
> <br>
> Also, it should be noted that ed produced a single error message: a<br>
> question mark. No wasting of teletype paper!<br>
> <br>
> The motivation for learning regular expressions was that that's how you<br>
> edited files. ed was the only game in town.<br>
> <br>
> (sh used a greatly restricted form of regular expressions, which were<br>
> documented on the sh man page.)<br>
> <br>
> Marc Rochkind<br>
> <br>
> On Sun, Mar 3, 2024 at 6:31???PM Will Senn <<a href="mailto:will.senn@gmail.com" target="_blank">will.senn@gmail.com</a>> wrote:<br>
> <br>
> > Hi All,<br>
> ><br>
> > I was wondering, what were the best early sources of information for<br>
> > regexes and why did folks need to know them to use unix? In my recent<br>
> > explorations, I have needed to have a better understanding of them, so I'm<br>
> > digging in... awk's my most recent thing and it's deeply associated with<br>
> > them, so here we are. I went to the bookshelf to find something appropriate<br>
> > and as usual, I've traced to primary sources to some extent. I started with<br>
> > Mastering Regular Expressions by Friedl, and I won't knock it (it's one of<br>
> > the bestsellers in our field), but it's much to long for my personal taste<br>
> > and it's not quite as systematic as I would like (the author himself notes<br>
> > that his interests are less technical than authors preceding him on the<br>
> > subject). So, back to the shelves... Bourne's, The Unix Environment, and<br>
> > Kernighan & Pike's, The Unix Programming Evironment both talk about them in<br>
> > the context of grep, ed, sed, and awk. Going further back, the Unix<br>
> > Programmer's Manual v7 - ed, grep, sed, awk...<br>
> ><br>
> > After digging around it seems like folks needed regexes for ed, grep, sed<br>
> > and awk... and any other utility that leveraged the wonderful nature of<br>
> > these handy expressions. Fine. Where did folks go learn them? Was there a<br>
> > particularly good (succinct and accurate) source of information that folks<br>
> > kept handy? I'm imagining (based on what I've seen) that someone might cut<br>
> > out the ed discussion or the grep pages of the manual and tape them to<br>
> > their monitors, but maybe I'm stooopid and they didn't need no stinkin'<br>
> > memory device for regexes - surely they're intuitive enough that even a<br>
> > simpleton could pick them up after seeing a few examples... but if that<br>
> > were really the case, Friedl's book would have been a flop and it wasn't<br>
> > :). So seriously, if you remember that far back - what was the definitive<br>
> > source of your regex knowledge and what were the first motivators for<br>
> > learning them?<br>
> ><br>
> > Thanks,<br>
> ><br>
> > Will<br>
> ><br>
> <br>
> <br>
> -- <br>
> *My new email address is <a href="mailto:mrochkind@gmail.com" target="_blank">mrochkind@gmail.com</a> <<a href="mailto:mrochkind@gmail.com" target="_blank">mrochkind@gmail.com</a>>*<br>
<br>
-- <br>
---<br>
Larry McVoy           Retired to fishing          <a href="http://www.mcvoy.com/lm/boat" rel="noreferrer" target="_blank">http://www.mcvoy.com/lm/boat</a><br>
</blockquote></div>