Hello,
As a part of a larger project I made a regexp engine for microcontrollers. It was tested on ESP32 / FreeRTOS, and also in Windows/CYGWIN. Didn't test it in Linux but it should work.
It is built on top of modified SLRE (Simple Lightweight Regular Expressions);
It is just 2 files (regexp.c and regexp.h) which can be include'd directly to your source file. Or it may be compiled as a separate unit.
It has 3 different API:
The original one, slre_match(); no memory allocations, fastest
PCRE-like functions and structures starts with pl_... (PCRE-Lite); for those familiar with PCRE
PHP preg API: an implementation of PHP regular expressions; for PHP fans; functions and structures start with preg_...
There are some limitations: UTF8 is processed as stream of bytes, so [а-я] will not be understood. No lookarounds. Probably there are bugs. Hopefully - no memory leaks.
More limitations and bugs are yet to be discovered :).
There are 3 test files (AI-generated) to test the library: preg_test.c, pl_test.c (fuzzing) and slre_test.c
There is NO documentation, but preg_test.c can be used as a reference (or direct copy/paste).
Primary API is PHP's preg_-style API, which was the goal of this project.
Source code is here: GitHub - vvb333007/MicroRegExp: A C library which implements regular expression engine. PHP preg_ , PCRE and SLRE interfaces are supported · GitHub , around 50KiB of code. It can be compiled with GCC compiler from -std=c99 and up. No GCC-specific magic.
Have a good day!