From: Miles Bader <miles.bader@necel.com>
To: "St\/n_P\/rm\/n" <Stan@SandPframing.com>
Cc: emacs-devel@gnu.org
Subject: Re: regexp-quote missing escapes in grouping constructs - Bug?
Date: Fri, 13 Jun 2008 15:17:34 +0900 [thread overview]
Message-ID: <buofxrhn9j5.fsf@dhapc248.dev.necel.com> (raw)
In-Reply-To: <d2afcfda0806121639g2d7a9762kf84edc9372645dd1@mail.gmail.com> (St's message of "Thu, 12 Jun 2008 19:39:12 -0400")
"St/n_P/rm/n" <Stan@SandPframing.com> writes:
> (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?
The backslashes you entered in the original lisp string were eaten by
the lisp reader, so there are no backslashes in the string. Since (, ),
|, etc., are not emacs regexp metacharacters (without a preceding
backslash), there's no need to quote them.
Here's what you probably meant:
(regexp-quote "[0-9]\\{2,4\\}\\(-\\|/\\)[0-9]?+\\(-\\|/\\)[0-9]\\{2,4\\}")
=> "\\[0-9]\\\\{2,4\\\\}\\\\(-\\\\|/\\\\)\\[0-9]\\?\\+\\\\(-\\\\|/\\\\)\\[0-9]\\\\{2,4\\\\}"
-Miles
--
Joy, n. An emotion variously excited, but in its highest degree arising from
the contemplation of grief in another.
next prev parent reply other threads:[~2008-06-13 6:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-12 23:39 regexp-quote missing escapes in grouping constructs - Bug? St/n_P/rm/n
2008-06-13 6:17 ` Miles Bader [this message]
2008-06-13 17:36 ` MON KEY
2008-06-13 22:21 ` Stefan Monnier
2008-06-14 4:16 ` tomas
2008-06-13 6:20 ` Herbert Euler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=buofxrhn9j5.fsf@dhapc248.dev.necel.com \
--to=miles.bader@necel.com \
--cc=Stan@SandPframing.com \
--cc=emacs-devel@gnu.org \
--cc=miles@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.