[2975] in BarnOwl Developers
Re: [PATCH] Add | to OWL_REGEX_QUOTECHARS
daemon@ATHENA.MIT.EDU (David A Benjamin)
Mon Mar 14 18:02:15 2011
Date: Mon, 14 Mar 2011 18:02:12 -0400 (EDT)
From: David A Benjamin <davidben@MIT.EDU>
To: Jeffrey Hutzelman <jhutz@cmu.edu>
cc: Karl Ramm <kcr@1ts.org>, Anders Kaseorg <andersk@mit.edu>,
barnowl-dev@mit.edu
In-Reply-To: <1300130010.28172.148.camel@destiny>
On Mon, 14 Mar 2011, Jeffrey Hutzelman wrote:
> Wait. What is OWL_REGEX_QUOTECHARS for?
>
> It seems to me that likely answers will all point to the correct value
> being a function of the particular RE syntax in use. If the RE syntax
> in use is always that of Perl (or Python, for that matter), then the
> correct set of things to quote is "anything that is not a letter or
> digit".
>
Um. There's a particular regex implementation (POSIX ones) used by
owl_regex, which OWL_REGEX_QUOTECHARS is specifically meant to quote. As
can be seen from the "OWL_REGEX" bit. There is no Python in the codebase,
and the value is never seen by Perl.
I guess we should perhaps push it and owl_text_quote into a
owl_regex_quote in regex.c, to avoid confusing bystanders like this, now
that owl_text_quote isn't used elsewhere...
(Tangentially, this would be another reason why I would not be opposed to
switching owl_regex to RE2. RE2 provides RE2::QuoteMeta so we don't have
to maintain this silly string.)
Anyway, Anders, your patch LGTM. Both versions.
David