A simplified history of regular expressions:
- In 1951, Stephen Kleene invented regular expressions.
- In 1966, Ken Thompson built the first software implementation of regular expressions, in the QED text editor for CTSS. UNIX ed is a cut down version of QED, popularizing the tradition of regular expressions in editors. grep started as a standalone version of the engine from ed. em, ex, vi, and vim evolved from ed.
- In 1987, Larry Wall spread regular expressions to the next generation of programmers through Perl. Gravely, it uses backtracking, spreading terrible performance for decades. It derives its engine from the rn newsreader, which derives it from Gosling Emacs. James Gosling told me he wrote it from scratch.
- In 2010, Russ Cox, having spent time at Bell Labs, rejected backtracking and built RE2, a fast and scalable engine, generalized from work on Google Code Search. Its ideas have spread to Go regexp and Rust regex, a new generation of engines. These engines dynamically select between specialized matchers, depending on the pattern.
- Since 2025, Ian Erik Varatalu has been researching regular expressions for his PhD and has produced a fast engine using symbolic derivatives. It implements seldom-included intersection and complement and efficiently implements lookaround, which had been exclusive to backtracking engines.
@cks Yes we also had way too many users on that poor old PDP-11/45 so no screen editors. I got really good at 'ed'. Sad since I had used EDT on a VT-100 and that editor was sweet!
I learned today that POSIX specifies a tool designed to assist you in reviewing & modifying LLM-generated code. In typical Unix fashion, they shortened "reviewing & modifying" to just two letters:
$ rm code.rs
It even has command-line options to [r]ecursively [f]ix whole directories of LLM-generated code:
$ rm -rf project/
It’s interesting that, as time passes, I grow my assortment of ed(1) scripts that optimize my workflows. Scripts that are not transferrable to e.g. #Emacs. But easy to write and integrate in The True Unix Editor.
These scripts are really useful, like an interactive narrowing grep I just wrote!
So I have perfect scripts and ed(1) versus Turing-complete Emacs and useless vi(m).
As time passes, I seem to gravitate towards ed(1).
Let’s see where that gets me.
CC @ed1conf
I got #linux 7.2 booting on my #Palm IIIxe and #Handspring #Visor! #nommu now to get my graffiti workalike working properly. (The stowaway keyboard works great for now. #ed is perfect on the 32x20 char fbcon) #busybox #buildroot. (See https://github.com/jsmemfault/uclinux)
@aartaka I tried ed(1) today and didn't hate it, what have you got me into!! ![]()
ed +2 quotes.txt
.
HACK THE WORLD!!!
Some delightful notes from @thalia on recent #unix V4 adventures including using ed(1)
https://github.com/thaliaarchi/unix-v4-demo/blob/main/README.md
My workshop at LRC on playing with UNIX V4 was a great success!
Everyone loved the teletype and terminal. In the manner of the day, I gave manuals to teach the system and ed (@ed1conf), and we now have a cohort of new ed users. A few groups solved or got close to solving my challenge of backporting the obfuscated mullender.c program from V7 to V4. Surprisingly with a dozen or so people on at once, UNIX handled the load fantastically.
So I wanted to share with you this little project of mine. I delved into "retro-necromancy" and reanimated one very old UNIX utility called ile written by Robert Pendleton in 1988. I found it on one of the Walnut Creek source code CDs from 1994.
What it does is simply works like an input line editor (hence ile) for shells and programs that do not support interactive line editing. To put it simply, it adds Emacs-style keybindings like ^A, ^E, ^K, ^U and so on and command history that you can easily navigate.
Of course, these days it's hard to find a shell that doesn't support line editing.
But this little tool can still be usable, for example, with ed. It's nice to have Emacs-style editing in ed.
It can work like shell replacement or just run like a "middleman" between any given program. It respects terminal settings and doesn't get in a way. Keybindings are configurable.
Needless to say, the code from 1988 wouldn't run on any modern system. It was written in K&R style because there was no ANSI C standard yet! And #UNIX was quite a different beast back then.
So I ported it to modern systems, rewrote outdated bits (like sgttyb ioctls and brutal utmp handling).
Currently it builds and runs on #Linux, #OpenBSD, #FreeBSD and #NetBSD. Hopefully without too much bugs.
You can find it on Codeberg:
https://codeberg.org/chesheer/ile
(initial article brought to my attention by @kickingvegas here:
https://sfba.social/@kickingvegas/116806774552300712 )
Apparently #Emacs has a builtin/plugin "run a program at a given time" functionality.
Fortunately POSIX already provides an at(1) command so if you find yourself editing in ed(1) and want to schedule a task:
$ ed file.txt
3141
! echo "play alert.mp3 | at "+20 minutes"
If your tool expects X running, you can set $DISPLAY as part of the command:
! echo DISPLAY=:0.0 xeyes | at noon
or
! echo DISPLAY=:0.0 xmessage "Go home" | at 5:00pm
⸻
NB: on some systems, the at(1) processing gets launched by a cron job that runs every 5 minutes, so you might not have more fine-grained resolution down to the minute.
The premier conference for ed(1), the standard text editor. Accessible at 300 baud.
Pronouns: it/its