From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jesper Harder Newsgroups: gmane.emacs.help Subject: Re: multiple alternatives regexp question Date: Wed, 07 Jan 2004 03:14:51 +0100 Organization: http://purl.org/harder/ Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1073443042 8916 80.91.224.253 (7 Jan 2004 02:37:22 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Jan 2004 02:37:22 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 07 03:37:19 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Ae3ZP-0007Xk-00 for ; Wed, 07 Jan 2004 03:37:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Ae4Tw-0006rC-35 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Jan 2004 22:35:44 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!usenet-fr.net!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!news.tele.dk!news.tele.dk!small.news.tele.dk!not-for-mail Original-Newsgroups: gnu.emacs.help X-Face: ^RrvqCr7c,P$zTR:QED"@h9+BTm-"fjZJJ-3=OU7.)i/K]<.J88}s>'Z_$r; List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:15756 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:15756 Joe Corneli 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)