From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Dyballa Newsgroups: gmane.emacs.help Subject: Re: #1: How to do vi's 'g/foo/s/x/y/' #2: + with a Q-R "yes/no?" Date: Sun, 8 Apr 2007 21:07:04 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1176059514 8445 80.91.229.12 (8 Apr 2007 19:11:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 8 Apr 2007 19:11:54 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: David Combs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Apr 08 21:11:04 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 1HacjU-0000da-NU for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Apr 2007 21:07:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HacnE-0000ki-5T for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Apr 2007 15:11:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Hacn0-0000gl-N2 for help-gnu-emacs@gnu.org; Sun, 08 Apr 2007 15:11:02 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Hacmy-0000gM-8i for help-gnu-emacs@gnu.org; Sun, 08 Apr 2007 15:11:01 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hacmy-0000gJ-6t for help-gnu-emacs@gnu.org; Sun, 08 Apr 2007 15:11:00 -0400 Original-Received: from fmmailgate03.web.de ([217.72.192.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HacjD-0004PY-Sx for help-gnu-emacs@gnu.org; Sun, 08 Apr 2007 15:07:08 -0400 Original-Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate03.web.de (Postfix) with ESMTP id 39A6A70D276E; Sun, 8 Apr 2007 21:07:07 +0200 (CEST) Original-Received: from [62.134.227.208] (helo=[192.168.1.2]) by smtp07.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.107 #114) id 1HacjD-0002Vk-00; Sun, 08 Apr 2007 21:07:07 +0200 In-Reply-To: X-Mailer: Apple Mail (2.752.2) X-Sender: Peter_Dyballa@web.de X-detected-kernel: Linux 2.4-2.6 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:42483 Archived-At: Am 07.04.2007 um 19:51 schrieb David Combs: > (1) How to do, in gnu-emacs, vi's 'g/foo/s/x/y/': M-x replace-regexp RET ^\(.*foo.*\)x\(.*\)$ RET \1y\2 RET and M-x replace-regexp RET ^\(.*\)x\(.*foo.*\)$ RET \1y\2 RET ? I think it's necessary to distinguish the two cases where the MUST HAVE is left or right of the MUST NOT BE. Instead of replace-regexp you can also use query-replace-regexp. It might be possible to unite these into one expression using alternatives. -- Greetings Pete Claiming that the Macintosh is inferior to Windows because most people use Windows, is like saying that all other restaurants serve food that is inferior to McDonald's.