Another RFC: regex in libiberty

Eli Zaretskii
Fri Jun 8 00:11:00 GMT 2001

> Date: Thu, 7 Jun 2001 21:27:31 -0400
> From: DJ Delorie <>
> I didn't get a clear feeling about what people wanted wrt this.  I saw
> three people propose three versions of regex, not much to go on.  Is
> this a big deal?  Will it really get used by everyone who currently
> has their own regex?  Is it important to try to use a BSD-licensed
> regex to minimize future problems?
> The two contenders seem to be a modified GNU regex and the
> ever-popular Henry Spencer's regex.  Does anyone have any strong
> opinions for either of these, or against any regex in libiberty at
> all?

One notorious problem with GNU regex is that it is quite slow for many
simple jobs, such as matching a simple regular expression with no
backtracking.  It seems that the main reason for this slowness is the
fact that GNU regex supports null characters in strings.  For
examnple, Sed 3.02 compiled with GNU regex is about 2-4 times slower
on simple jobs than the same Sed compiled with Spencer's regex
library.  (The DJGPP port of Sed is actually distributed with two
executables, one build with GNU regex, the other with Spencer's, for
this very reason.)

So perhaps it might help to have more than just GNU regex in
libiberty, for those applications that don't need to support null
characters, and where regular expressions are used a lot, and so need
to be fast.

More information about the Gdb mailing list