lwre — lightweight regular expression matching for C

lwre is a lightweight regular expression matching library intended for those occasions when you want to search in text with a minimum of fuss, bloat and complexity. Compared to other common solutions it is ten times smaller than the POSIX regex(3) functions and more than thirty-five times smaller than the popular PCRE package. It has far fewer bells, whistles, dials and guages, but in return offers the simplest possible interface, very reasonable performance, and freedom from the exponential complexity that renders backtracking implementations useless for certain kinds of regular expression.

A typical usage scenario might be:

struct re re= RE_INITIALISER("your regular expression here");
int nmatched= re_match(&re, your string to search here);
if (nmatched > 0) puts("found it!");

lwre supports UTF-8 encoded multibyte characters and submatch recording, including within repetitions (creating multiple submatches according to the number of times the repetition matches).

Download the source code: lwre-0.0.2.tar.gz
Browse the source code: lwre-0.0.2
Read the manual page: lwre.3.html

lwre is distributed under the MIT license. You will not contract an incurable Religiously Transmitted Disease if you decide to include it in your own project.

If you find bugs or have suggestions, please send them to Ian at the domain name of this web site. Thanks!


Version history

2013-12-21 lwre-0.0.2
Remove redundant dependencies from Makefile. Rename re.source -> re.expression to match manual page.
2013-12-20 lwre-0.0.1
First public "alpha" release.