grep is the best-known case of the regular-expression code being extracted from ed for use elsewhere. Another case is the regex library, created by me, for use in some PWB code we were working on, probably around 1974. My recollection is that the code was in assembler, as I think ed remained in assembler long after UNIX itself went to C. I wrapped it for calling from C, of course... we didn't code in assembler.
--Marc