bug-ed
[Top][All Lists]
Advanced

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

Fwd: Case-insensitive regular expressions


From: John Cowan
Subject: Fwd: Case-insensitive regular expressions
Date: Wed, 7 Jul 2021 13:59:42 -0400

On Tue, Jul 6, 2021 at 9:33 PM Shawn Wagner <shawnw.mobile@gmail.com> wrote:


> Going that route, I'd rather lift a page from perl & co and indicate it by
> looking for (?i) at the very beginning of a regular expression, and then
> just skipping over those characters when passing the RE to regcomp().
>

The problem is that it is backwards incompatible: what if you are searching
for the regex /(?i)j/?  That must work exactly as before, finding lines
with the characters "(?i)" followed by "j".  Using \c involves an undefined
escape sequence, so you are used to writing /\\c/ if you want to search for
backslash followed by c.

Looking through the GNU ed source, that might be the easiest approach.
> Checking for a flag after the RE before it's compiled is looking a bit
> complicated to add.
>

I have no problem if you restrict \c to appear at the beginning of the
regex only.  I suspect it works anywhere in vim because that behavior falls
out of the regex parsing loop.

I think your patch will be easy to change.

>
>>


reply via email to

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