regex - Henry Spencer's regular expression libraries

There are three bodies of source code that can be referred to as "Henry Spencer's regular expression library".

Firstly the "old library" or the "book library". This was originally posted to the Usenet group mod.sources on 19 January 1986 and was updated for the book Software Solutions In C, ed. Dale Schumacher, Academic Press, 1994 [ref: Usenet]. This version was obtained from the ftp server at (now defunct). The man page is dated 5 September 1996 and original tar archive was dated 4 April 1998.

The library can be obtained from a github repository, or download

The second is the "BSD library". This is a POSIX.2 compliant library that was included in 4.4BSD Unix. Spencer wrote that it was basically an alpha release, and pretty slow [ref: Usenet]. For more information on this library, see the README and COPYRIGHT files and two man pages regex(3) and regex(7). This version was also obtained from and is dated 10 August 1999.

The library can be obtained from a github repository, or download

I have also prepared a shared library version, using Autoconf etc., to allow installation as a system library in GNU/Linux or similar systems. See the WHATSNEW page for details of changes.

This version also has a github repository, or download rxspencer-alpha3.8.g5.tar.gz (December 15, 2013).

The third is the "Tcl library", which was added to Tcl in 1999 (version 8.1) and supports wide-character Unicode. Although Spencer intended to release this library as a standalone package [ref: Usenet], I don't think he ever got around to it.

However, a couple of ports are available. Walter Waldo made a C++ library, which can be obtained from a github repository, or download Documentation is somewhat lacking for this library, but here's a basic example for the ASCII version: hsrex-char.c. The Tcl library documentation may also be useful.

There's also a Java port by Basis Technology Corporation available in github.