|
|
@ -2,16 +2,20 @@ SLRE: Super Light Regular Expression library |
|
|
|
============================================ |
|
|
|
============================================ |
|
|
|
|
|
|
|
|
|
|
|
SLRE is an ISO C library that implements a subset of Perl regular |
|
|
|
SLRE is an ISO C library that implements a subset of Perl regular |
|
|
|
expression syntax. Main focus of SLRE is small size, [simple |
|
|
|
expression syntax. Main features of SLRE are: |
|
|
|
API](https://github.com/cesanta/slre/blob/master/slre.h), clarity of code |
|
|
|
|
|
|
|
and extensibility. It is making it perfect for tasks like parsing network |
|
|
|
|
|
|
|
requests, configuration files, user input, etc, when libraries like |
|
|
|
|
|
|
|
[PCRE](http://pcre.org) are too heavyweight for the given task. Developers in |
|
|
|
|
|
|
|
embedded would benefit most. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Extensibility is another great aspect of SLRE. For example, if one wants to |
|
|
|
* Written in strict ISO C, conforming to ANSI C'89 |
|
|
|
introduce a new metacharacter, '\i', meaning 'IPv4 address', it is easy to do |
|
|
|
* Small size (compiled x86 code is about 4kB) |
|
|
|
so with SLRE. |
|
|
|
* Uses no dynamic memory allocation and small stack space |
|
|
|
|
|
|
|
* [Simple API](https://github.com/cesanta/slre/blob/master/slre.h) |
|
|
|
|
|
|
|
* Implements most useful subset of Perl regex syntax (see below) |
|
|
|
|
|
|
|
* Easily extensible. For example, if one wants to introduce a new |
|
|
|
|
|
|
|
metacharacter `\i`, meaning "IPv4 address", it is easy to do so with SLRE. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SLRE is perfect for tasks like parsing network requests, configuration |
|
|
|
|
|
|
|
files, user input, etc, when libraries like [PCRE](http://pcre.org) are too |
|
|
|
|
|
|
|
heavyweight for the given task. Developers of embedded systems would benefit |
|
|
|
|
|
|
|
most. |
|
|
|
|
|
|
|
|
|
|
|
## Supported Syntax |
|
|
|
## Supported Syntax |
|
|
|
|
|
|
|
|
|
|
@ -71,3 +75,11 @@ which should be an array of following structures: |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
printf("Error parsing [%s]: [%s]\n", request, error_msg); |
|
|
|
printf("Error parsing [%s]: [%s]\n", request, error_msg); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Licensing |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SLRE is dual licensed. It is available either under the terms of [GNU GPL |
|
|
|
|
|
|
|
v.2 license](http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) for |
|
|
|
|
|
|
|
free, or under the terms of standard commercial license provided by [Cesanta |
|
|
|
|
|
|
|
Software](http://cesanta.com). Businesses who whish to use Cesanta's products |
|
|
|
|
|
|
|
must [license commercial version](http://cesanta.com/products.html). |
|
|
|