bug-ed
[Top][All Lists]
Advanced

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

Case-insensitive regular expressions


From: Shawn Wagner
Subject: Case-insensitive regular expressions
Date: Tue, 6 Jul 2021 13:38:10 -0700

Sometimes it'd be nice to match a RE case-insensitively. A few approaches
to implementing this in ed:

1. A command line switch to match all REs that way. Easiest to add, but
then what if you want some patterns to be sensitive and some not in the
same session? It's just the reverse of the current form.

2. Adding an I flag to REs in address ranges, s, g, etc. (I instead of i to
match GNU sed and for the same reason - to avoid ambiguity with the
existing i command).

3. Take a page from GNU grep and add support for using PCRE2 regular
expression engine via ed -P, where the case-sensitivity can be controlled
by a toggle in the body of individual REs. Pros: Doesn't require modifying
the command parser, just the RE compiling and matching bits. Cons:
Complicates the bare bones configure script. Would be easier to add a test
for the library if ed used autoconf or cmake... an alternative that would
likely end up as a fork if I'm motivated enough due to the sheer scope is
rewriting in C++ and using standard C++ regular expressions, which support
multiple dialects without requiring a third-party library.

Thoughts?


reply via email to

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