bug-gnulib
[Top][All Lists]
Advanced

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

Re: Plain text matching with regex: RE_PLAIN


From: Reuben Thomas
Subject: Re: Plain text matching with regex: RE_PLAIN
Date: Wed, 15 Sep 2010 02:24:57 +0100

On 15 September 2010 02:09, Eric Blake <address@hidden> wrote:
> On 09/14/2010 06:27 PM, Reuben Thomas wrote:
>>
>> The attached patch adds a new syntax flag, RE_PLAIN.
>
> Why can't you instead add \ escaping to all existing regex meta-characters
> that occur in the string, at which point you get the same effect without a
> new flag?

Because that is error-prone (in particular, I would have to take the
current syntax into account). So, I could do it reliably by writing
and testing a routine to do it, but that would be significantly more
code (to avoid creating the same problem for others, it would need to
be added to GNU regex, not just used by me). It would also be harder
to use: once you make a new string, you have to consider allocation in
C.

Rather than bother with all that, it's simpler just to write a
plain-text matching routine, but then I'm back where I started.

> And while the addition of a new flag may be worthwhile, I think
> that the divergence between glibc and gnulib is already too far; you need to
> get this approved in glibc before we go adding it to gnulib and hurt our
> chances of merging yet another difference between the two code bases.

I'll give it a go.

In the meantime is there any better way to use this for myself than
simply maintaining a variant version of GNU regex? e.g. some way of
maintaining a patch against gnulib...

-- 
http://rrt.sc3d.org



reply via email to

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