[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] Does regex.c support non-greedy quantifiers?

From: Stepan Kasal
Subject: Re: [bug-gnulib] Does regex.c support non-greedy quantifiers?
Date: Tue, 12 Apr 2005 16:18:37 +0200
User-agent: Mutt/1.4.1i


On Mon, Apr 11, 2005 at 04:22:11PM +0200, Hrvoje Niksic wrote:
> > But I think there is consensus that this version should be replaced
> > by the regex code from GNU C Library (glibc).
> I see.  Has that code been used and tested outside glibc?  Is it
> portable to non-glibc systems?

the code is included in latest versions of GNU awk, and in GNU sed 4.x.

I know that Arnold, the GNU awk maintainer, takes much care about
portability to various systems.  I believe his testers compile gawk on
VMS and other unusual systems.

So I'd conclude that glibc's regex is safe in this respect.

> It should also be noted that GNU grep,
> according to its manual, supports Perl-like regular expressions and is
> also worth looking into.

No, there is nothing interesting.  GNU grep has an ability to link
against pcre, if the configure finds it.

Morover, grep --perl-regexp is still experimental (though the doc's fail
to state this clearly).  grep is line oriented, so the matched string
can _never_ contain a newline; there is no way to explain this to
(existing versions of) pcre.

GNU grep up to 2.5.x uses the enacs' regex.c, future versions (>= 2.6)
will join gawk and sed and will use the glibc's regex.c.

(To be exact, gawk and grep also use dfa.c.  It's quicker then regex.c,
but it cannot handle backreferences, so you have to run regex.c on the
suspects make the final decision.  I guess you don't want it.)

Have a nice day,
        Stepan Kasal

reply via email to

[Prev in Thread] Current Thread [Next in Thread]