Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 16 Jul 2013 11:10:34 -0400
From: LM <>
Subject: regex libs (was Re: embedded newbies site.)

On Tue, Jul 16, 2013 at 10:00 AM, Rich Felker <> wrote:

> The whole concept of regular expressions is that they're regular,
> meaning they're matchable in O(n) time with O(1) space. PCRE (the
> implementation) uses backtracking for everything, giving it
> exponentially-bad performance (JIT cannot fix this), and PCRE (the
> language) has a lot of features that are fundamentally not regular and
> thus can't be implemented efficiently. Also, the behavior of some of
> the features (e.g. greedy vs non-greedy matching) were not designed
> intentionally but just arose out of the backtracking implementation,
> and thus don't make a lot of sense unless you think from the
> standpoint of such an implementation.

Went back and rechecked the documentation (  You're both right, PCRE is offering
the Perl regular expressions
implementation even when one uses the pcreposix interface.  Would have been
nice if they offered actual regular expressions handling if you only want
to use the POSIX compatible part of the interface.

So what are some good regex library solutions?  I'm also wondering if there
are some good cross-platform portable library solutions (or if PCRE is the
best pattern matching solution from a portability standpoint even if it's
not strictly regex compatible).

There's , but I've read some issues with its
performance in a few web articles and didn't have much luck with
portability to non-Linux platforms.  There's the glibc solution:  There's TRE (, which some BSD systems want to use to
create their grep ( ).  There's the
Oniguruma library ( ). There's
Henry Spencer's regex ( ).  That looks
promising for portability.  There's Further searching also
turns up which may have the same issues as
PCRE.  ICU seems to offer regex code (, probably same issue as
PCRE.  (Just my opinion, but ICU seems to do a lot of stuff for just one
library.)  There's BOOST's regex ( ) which a lot of web
sites recommend, but I've just never been a fan of the BOOST libraries.
The Heirloom Project has regex code ( ).
Have I missed any other interesting solutions?

Sounds like I need to better clarify between regex pattern matching
libraries and pattern matching libraries on the musl wiki's alternative
library page.  If you recommend any of the above libraries or possibly
others and think certain implementations would be useful to others, let me
know and I'll add the links to the wiki.  I haven't really added anything
for pattern-matching libraries beyond benchmark information.



Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.