After observing the outstanding performance of Henry Spencer's Regular Expression library in a series of threads on Reddit, I decided to rip the code out of Tcl and make something self-contained and callable from C. It seems to work ok, but as of this version, is mostly untested. See test.c for the very lame test suite I have included. I want to add some nice wrapper libraries as well, but that is a project for another time

Changes from Tcl code

I basically had to emulate parts of Tcl that were not part of the standard Unix C libraries. The two biggest elements of this were reproducing the Unicode UTF functionality (I chose, possibly naively, to use the wchar.h stuff), and DStrings, which are a growable string class that features an initial static buffer (which I ripped and included directly from tclUtil.c). I also had to add some supporting defines here and there, but nothing too interesting. It compiles ok for me on FreeBSD, but I haven't tested Linux. Please let me know how it works for you.

Regex syntax

See the excellent Tcl Regular Expressions wiki page for information about what features this library supports. Also be aware of some potential problems with this library. I haven't attempted to verify them.




Thomas Lackner

Many thanks to my employer, Straat Investments LLC., for sponsoring this work.