From: Jesper Harder <harder@myrealbox.com>
Subject: Re: multiple alternatives regexp question
Date: Wed, 07 Jan 2004 03:14:51 +0100 [thread overview]
Message-ID: <m3brpg5wtg.fsf@defun.localdomain> (raw)
In-Reply-To: mailman.87.1073442133.928.help-gnu-emacs@gnu.org
Joe Corneli <jcorneli@math.utexas.edu> writes:
> Unfortunately, when I search and replace like so:
>
> (let ((case-fold-search nil))
> (while (re-search-forward "\\([[:lower:]]\\|[[:digit:]]\\|A\\)\\([A-Z]\\)"
> nil t)
> (replace-match (concat (match-string 1) " " (match-string 2)))))
>
> on something like
>
> ProofOfPropertiesOfTraceOfAMatrix
>
> I get back
>
> Proof Of Properties Of Trace Of AMatrix
> ^
> Why is the `A' not being treated the way I want the first time
> around?
It doesn't work because `replace-match' leaves point after the
replacement text. You could use something like this instead:
(replace-match "\\1 " t nil nil 1)
next prev parent reply other threads:[~2004-01-07 2:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1Ae1Fl-0004fM-Lz@monty-python.gnu.org>
2004-01-07 1:19 ` multiple alternatives regexp question Joe Corneli
[not found] ` <mailman.87.1073442133.928.help-gnu-emacs@gnu.org>
2004-01-07 2:14 ` Jesper Harder [this message]
2004-01-07 10:13 ` Stefan Monnier
[not found] <E1AeGBR-00015s-IU@monty-python.gnu.org>
2004-01-07 16:57 ` Joe Corneli
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=m3brpg5wtg.fsf@defun.localdomain \
--to=harder@myrealbox.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.