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: Sun, 5 Mar 2006 13:14:48 -0600 (CST)

>From my previous reply:

   As Andreas already pointed out, there is _no_ way to determine whether
   either a `]' _or_ a `\\]' has to be taken literally or closes a
   character alternative without parsing the regexp forward from the start.

Well, _in certain cases_, you might be able to determine it sooner by
parsing backward from the `]'.  If you see a `]' or "\\]" you know it
has to be taken literally.  (Note: the "\\" are irrelevant to the
question again.)  But then you do not know whether that earlier `]' or
"\\]" has to be taken literally, without keeping going.  If you see an
unquoted [, you know that the `]' closes a character alternative, but
you still do not know whether that `[' is opening that character
alternative or has to be taken literally, as in "[asd[fgh]".  If you
encounter another `[' next you know that either that one opens your
character alternative _or_ that the regexp was very poorly written.

But there definitely are many cases where you would have to parse back
all the way to the beginning.

Sincerely,

Luc.





reply via email to

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