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 07:51:47 -0600 (CST)

Martin Rudalics wrote:

   But you should
   occasionally think of less experienced programmers who try to guess the
   motivations for writing an expression like

   (string-match "[^\\]\\(\\([\\][\\]\\)*\\)\"[ \t,]*"
                                            definition start)

   in `mailalias.el'.  It's got no less than three backslashes preceding
   non-escaped right brackets.  Can you tell me what the author wants to
   match?

Unless it really is too early in the morning for me, something that
starts with something that is not a backslash, then an even number of
backslashes, then a ", then a sequence of non-newline whitespace or
commas.  The one pair of \\(...\\) that is not needed for this meaning
is probably meant for use with match-data.

What is the point you are trying to make?  That

"[^\\]\\(\\(\\\\\\\\\\)*\\)\"[ \t,]*"

would be easier to read?  Not for me.

Sincerely,

Luc.




reply via email to

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