emacs-devel
[Top][All Lists]
Advanced

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

Re: Unquoted special characters in regexps


From: Luc Teirlinck
Subject: Re: Unquoted special characters in regexps
Date: Fri, 3 Mar 2006 16:41:15 -0600 (CST)

Martin Rudalics wrote:

    > To give a less technical answer than in my previous response, an
    > _unquoted_ ", followed by a bunch non-newline whitespace or commas.

   (string-match "[^\\]\\(\\([\\][\\]\\)*\\)\"[ \t,]*" "\" ,") => nil

Less technical means more potential for ambiguity.  Of course the
regexp does _not_ match "\" ,", because that would not guarantee that
the " it found is unquoted.  Apparently, point is at the beginning of
a string and the regexp searches for the ending unquoted " by
searching, as I said in my previous message, for something that is
_not_ a backslash, then an even number of backslashes, then a ", then
a bunch of non-newline whitespace or commas.  Apparently, the code
relies on the assumption that the string does not consist of _only_
backslashes.

ELISP> (string-match "[^\\]\\(\\([\\][\\]\\)*\\)\"[ \t,]*" "012\" ,")
2

Sincerely,

Luc.




reply via email to

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