From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Tim Morley \(remove vegetable for email address\)" Newsgroups: gmane.emacs.help Subject: Emacs regexp/incrementer question Date: Thu, 16 Jan 2003 12:15:23 +0100 Organization: Guest of France Telecom Oleane's newsreading service Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org X-Trace: main.gmane.org 1042715770 32701 80.91.224.249 (16 Jan 2003 11:16:10 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 16 Jan 2003 11:16:10 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18Z80H-0008VJ-00 for ; Thu, 16 Jan 2003 12:16:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18Z7zk-0002f9-01 for gnu-help-gnu-emacs@m.gmane.org; Thu, 16 Jan 2003 06:15:36 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!fr.clara.net!heighliner.fr.clara.net!freenix!oleane.net!oleane!nnrp.oleane.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 19 Original-NNTP-Posting-Host: 194.206.222.73 Original-X-Trace: s1.read.news.oleane.net 1042715655 17242 194.206.222.73 (16 Jan 2003 11:14:15 GMT) Original-X-Complaints-To: abuse@oleane.net Original-NNTP-Posting-Date: Thu, 16 Jan 2003 11:14:15 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Original-Xref: shelby.stanford.edu gnu.emacs.help:109018 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:5546 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:5546 Hi all. Does anybody know of a way to include an incrementing number in a regexp search-and-replace in Emacs? What I want to do is search for a regexp, and the first time I find it, replace it with "case 1", the second time replace it with "case 2", etc. Even if the solution is a several-stager, I'd be more than happy, because I'm currently having to replace each occurrence with "case xxx" and then change each "xxx" to a number by hand afterwards -- hardly ideal. I could use awk or something to change the xxx's to incrementing numbers, but I'd much prefer to do it all in Emacs if I can. Thanks in advance for your help. Tim Morley