"Mark E. Mallett" <mem(_at_)mv(_dot_)mv(_dot_)com> writes:
On Thu, Jul 21, 2005 at 12:28:45AM +0200, Kjetil Torgrim Homme wrote:
Modifier ":quoteregex"
Every character with special meaning for :regex (".", "*", "?"
etc.) is prefixed with "\" in the expansion. This modifier is
only available when the "regex" extension is in effect.
Do we want to more specifically say something like "Ensures that "
[ ...every character with special meaning is prefixed with "\" ... ],
i.e. if a character is already quoted, we don't want another quote
character to be added (otherwise the quoted character would become
unquoted, a literal quote character would be added, etc).
No! :quotewildcard/:quoteregex must escape any backslash characters
that are already present so that the resulting pattern or regexp
will match them literally. For example, the wildcard pattern for
matching the literal text
foo\*bar
is
foo\\\*bar
and _not_
foo\*bar
Ergo, something like
set :quotawildcard "b" text:
foo\*bar
.
must have the same result as
set "b" text:
foo\\\*bar
.
(I used a multiline literal to avoid confusing the issue with the
extra round of backslash escaping that quoted-strings under go.)
Philip Guenther