4. Adopt the vim convention that \c anywhere in a regex makes it case-insensitive. Clean and fully isolated from the rest.
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(). 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. On Tue, Jul 6, 2021 at 4:12 PM John Cowan <co...@ccil.org> wrote: > > > On Tue, Jul 6, 2021 at 4:38 PM Shawn Wagner <shawnw.mob...@gmail.com> > wrote: > > 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. >> > > I think that would be Very Bad. > >> 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). >> > > A possibility. > >> 3. Take a page from GNU grep and add support for using PCRE2 regular >> expression engine via ed -P, >> > > Certainly provides the most function, but may end up with an editor whose > regex package is larger than the rest of it! > > 4. Adopt the vim convention that \c anywhere in a regex makes it > case-insensitive. Clean and fully isolated from the rest. > > Implementation notes: (a) You need to foldcase both the regex (before it > is compiled) and the text being matched; (b) Unicode case folding has a > bunch of special cases. > > > >