Lightweight regex parser

I'd like to use a Regex parser to aid in some string processing in a C application. I'm ideally looking for something lightweight and open-source. The target platform is an embedded system so we're looking to save as much as possible with memory consumption in particular. I've found a number of options online but was wondering if anyone can make additional suggestions that may help in this particular context.

Many thanks,


Scintilla, an open source text editor component, uses Ozan S. Yigit's RE engine

It was chosen because it is in the public domain (so no encumbering license) and very lightweight. But it is a bit limited... For what it is worth, RESearch.cxx uses a slightly more modern code (converted to C++ but it shouldn't be complex to convert it back to C) with some minor extensions made by myself (support of \d \s \w etc.).

There are some alternatives, like Henry Spencer's regular expression libraries.

Come to think of it, the Lua regex engine (in string library, gsub implementation among others) is probably fast and small too, like the language itself. It has its quirks and limitations, but it is very usable.

The side project LPeg can be an interesting alternative to REs, still lightweight yet powerful.

If you don't require a full featured regex implementation (and it sounds like you don't) then the code written by Brian Kernighan and Rob Pike highlighted in Beautiful Code will probably work for your needs. I found a Dr. Dobb's article which I think is the origination of the code which appears in the book.

Given your lightweight requirements, I'd recommend Henry Spencer's regex library which implements the POSIX BRE and ERE regex flavors. These are standard regex flavors that your users are likely already familiar with.

Need Your Help

Get list of places surrounding user's current location

android search google-maps location

So, I've seen many questions about this here on SO and in other forums, but no definite answer. It seems like such a basic process, so I don't understand why I can't find any answers for it.

Spectrum Analyzer for line-in?

c# winforms audio

I'm looking for a small control (and the code behind that analizes) that shows me the incoming sound of my line-in/microphone.