From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: case change in replacement text with regex-replace Date: Mon, 16 Apr 2007 01:10:46 +0200 Organization: The Church of Emacs Message-ID: <87odlpxmh5.fsf@debby.local.net> References: <461cc717$0$5074$ba4acef3@news.orange.fr> <4621e0c0$0$5094$ba4acef3@news.orange.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1176678694 8465 80.91.229.12 (15 Apr 2007 23:11:34 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Apr 2007 23:11:34 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Le TeXnicien de Surface Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 16 01:11:27 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HdDsU-0005Dw-7I for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Apr 2007 01:11:26 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdDx1-00043z-J6 for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Apr 2007 19:16:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HdDwl-0003yn-2V for help-gnu-emacs@gnu.org; Sun, 15 Apr 2007 19:15:51 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HdDwj-0003v8-3C for help-gnu-emacs@gnu.org; Sun, 15 Apr 2007 19:15:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HdDwi-0003uu-Vu for help-gnu-emacs@gnu.org; Sun, 15 Apr 2007 19:15:49 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.177]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HdDsA-0007Zf-FX for help-gnu-emacs@gnu.org; Sun, 15 Apr 2007 19:11:06 -0400 Original-Received: from [84.167.31.41] (helo=debby.local.net) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis), id 0ML25U-1HdDs71a4g-0007VP; Mon, 16 Apr 2007 01:11:05 +0200 Original-Received: from dieter by debby.local.net with local (Exim 4.63) (envelope-from ) id 1HdDrq-0000sH-KO; Mon, 16 Apr 2007 01:10:46 +0200 In-Reply-To: <4621e0c0$0$5094$ba4acef3@news.orange.fr> (Le TeXnicien de Surface's message of "Sun\, 15 Apr 2007 10\:22\:18 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.95 (gnu/linux) X-Provags-ID: V01U2FsdGVkX18LDdgiOhZvpkWz9u1UIHtFjnnciLsqAXEKtSR FHDgrUE+Q/LH2e43tVCSOgUVOJcf0y+SrmZKQ4doNs/BYFawFL 1DeDy++7YHUUGZFHv1mYqVm5cPoemWr X-detected-kernel: Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42706 Archived-At: Le TeXnicien de Surface writes: > I know I will obtain a string of two characters (the capturing regexp is in > fact immaterial) and what I would like to obtain from, say, AB is the > string `AB ab Ab aB' as previously stated. I could even easily capture two > strings of one character each. So, in a nutshell: How do we change the case > of a character, previously captured, in the replacement string? Is there > anything as the perl \U to be used in the replacement part of a \U I didn't see in the elisp manual > regex-search and replace? I'd try it with the \, command with replace-regexp though (info "(emacs) Regexp Replace") <- put cursor behind parenthesis and type C-x C-e. The following is just an idea, I didn't check it. I assume you must also make the search and replace command case sensitive. IDEA: \(.\)\(.\) -> \,(concat (upcase \1)(downcase \2) " " (...)) -- Best wishes H. Dieter Wilhelm Darmstadt, Germany