emacs-devel
[Top][All Lists]
Advanced

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

RE: regexp-quote missing escapes in grouping constructs - Bug?


From: Herbert Euler
Subject: RE: regexp-quote missing escapes in grouping constructs - Bug?
Date: Fri, 13 Jun 2008 14:20:22 +0800

> (regexp-quote "[0-9]\{2,4\}\(-\|/\)[0-9]?+\(-\|/\)[0-9]\{2,4\}")
> 
> ---> "\\[0-9]{2,4}(-|/)\\[0-9]\\?\\+(-|/)\\[0-9]{2,4}"
> 
> Am I misunderstanding something?
> Shouldn't passing that string to regexp-quote give back something more
> like this:
> 
> ---> "[0-9]\\{2,4\\}\\(-\\|/\\)[0-9]?+(-\\|/)[0-9]\\{2,4\\}"

I think this is because `regexp-quote' sees the string being processed
by the Lisp reader, i.e. "\{" ==> "{" in the internal representation,
while "\\{" ==> "\{":

     ELISP> (regexp-quote "[0-9]\{2,4\}")
     "\\[0-9]{2,4}"
     ELISP> (regexp-quote "[0-9]\\{2,4\\}")
     "\\[0-9]\\\\{2,4\\\\}"
     ELISP>

Regards,
Guanpeng Xu
_________________________________________________________________
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE




reply via email to

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