From: Dave Love <d.love@dl.ac.uk>
Subject: replace-match with optional fields
Date: Mon, 05 Jan 2004 14:54:54 +0000 [thread overview]
Message-ID: <rzqy8sma1j5.fsf@albion.dl.ac.uk> (raw)
The doc string for replace-match is unclear, and the Lisp manual
doesn't mention this behaviour, but it think it's wrong:
The doc says
`\N' means substitute what matched the Nth `\(...\)'.
If Nth parens didn't match, substitute nothing.
I'd hope `nothing' means `substitute an empty string' rather than
`don't substitute'; I'd guess that was the intention. It's not what
happens, though:
(let ((s "foo"))
(string-match "\\(foo\\).*\\(bar\\)?" s)
(replace-match "1: \\1, 2: \\2" t nil s))
=> "1: foo, 2: \\2"
This behaviour doesn't seem useful, in contrast to substituting an
empty string.
next reply other threads:[~2004-01-05 14:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-05 14:54 Dave Love [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-01-10 0:44 replace-match with optional fields Luc Teirlinck
2004-01-11 19:37 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=rzqy8sma1j5.fsf@albion.dl.ac.uk \
--to=d.love@dl.ac.uk \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).