From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
Subject: Re: Easy regexp issue
Date: Fri, 19 Jan 2007 23:09:42 -0700 [thread overview]
Message-ID: <eosbmq$k1h$1@sea.gmane.org> (raw)
In-Reply-To: <barmar-226FDA.02492519012007@comcast.dca.giganews.com>
Barry Margolin wrote:
> In article <mailman.3295.1169191738.2155.help-gnu-emacs@gnu.org>,
> Kevin Rodgers <kevin.d.rodgers@gmail.com> wrote:
>> See the LITERAL argument in the doc string for replace-regexp-in-string:
>>
>> (replace-regexp-in-string "/" "\\" "c:/emacs/lisp/" nil t)
>
> Or
>
> (replace-regexp-in-string "/" "\\\\" "c:/emacs/lisp/")
>
> This is necessary because backslash is an escape character at two
> levels: Lisp strings and regexp replacement strings (e.g. the sequence
> \1 in the replacement represents a group matched in the regexp). So the
> replacement string needs to be \\, and you need to escape each \ in the
> string.
That was my point: If you don't need the backslash to be interpreted in
the replacement string as a submatch reference, specify a non-nil
LITERAL argument -- which should execute faster to boot. Of course,
there's no way around the need to escape the backslash in the Lisp
string.
--
Kevin Rodgers
Denver, Colorado, USA
prev parent reply other threads:[~2007-01-20 6:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-18 18:32 Easy regexp issue HS
2007-01-18 19:32 ` Joost Kremers
2007-01-19 7:28 ` Kevin Rodgers
[not found] ` <mailman.3295.1169191738.2155.help-gnu-emacs@gnu.org>
2007-01-19 7:49 ` Barry Margolin
2007-01-19 13:29 ` HS
2007-01-22 19:26 ` Robert Thorpe
2007-01-20 6:09 ` Kevin Rodgers [this message]
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='eosbmq$k1h$1@sea.gmane.org' \
--to=kevin.d.rodgers@gmail.com \
/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.