|
From: | Paul Eggert |
Subject: | Re: icalendar.el bug fix patch |
Date: | Sun, 3 Nov 2019 16:50:10 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 11/3/19 1:34 PM, Mattias Engdegård wrote:
There are so many regexp engines these days that I can't keep track of them all, but there may be precedences elsewhere.
Some of the precedent discussed in this thread seems to be based on Perl, which introduced the "single-line" concept and which has notations like (?s:RE) to cause RE to operate in single-line mode which means '.' within RE matches any single character. However, Perl later added another escape '\N' which matches any single non-newline character even when single-line mode is in effect - which sounds a bit like piling one kludge atop another.
This remind me of Perl's using ^ and $ to mean either the beginning and end of text or the beginning and end of line, depending on whether Perl's m flag is in effect. Emacs solves this in a different and arguably better way, by using \` and \' for beginning and end of text instead. If we want to keep with this tradition, Emacs should use a separate escape sequence for "match any single character including newline".
On looking into what other systems do, I find that I prefer Vim's syntax of '\_.' to match any single character including newline. (Vim has other uses for \_ which we could decide separately whether to adopt.) Partly this is because \! might better be used to denote regular expression negation.
A bit of both. The choice of '\!' was off-the-cuff and on second thought it'd probably be better to use Vim's syntax, since it's a precedent and it leaves us better room for future extensions.Paul mentioned \! which would do, but I'm not sure if it was an off-the-cuff suggestion or a carefully considered proposal.
[Prev in Thread] | Current Thread | [Next in Thread] |