From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jeremiah.dodds@gmail.com Newsgroups: gmane.emacs.help Subject: Re: replacing phrases: matching line feeds in regular expressions, since \s- doesn't work Date: Sat, 18 Feb 2012 14:33:23 -0500 Message-ID: <87ehts2ayk.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1329593654 30196 80.91.229.3 (18 Feb 2012 19:34:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 18 Feb 2012 19:34:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 18 20:34:14 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ryq2v-0006VO-CF for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Feb 2012 20:34:13 +0100 Original-Received: from localhost ([::1]:41776 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryq2u-0007UY-ME for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Feb 2012 14:34:12 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:59307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryq2p-0007UQ-OY for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 14:34:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ryq2o-0008Lc-9y for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 14:34:07 -0500 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:44751) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryq2o-0008Ki-46 for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 14:34:06 -0500 Original-Received: by pbcwz17 with SMTP id wz17so5222633pbc.0 for ; Sat, 18 Feb 2012 11:34:05 -0800 (PST) Received-SPF: pass (google.com: domain of jeremiah.dodds@gmail.com designates 10.68.210.12 as permitted sender) client-ip=10.68.210.12; Authentication-Results: mr.google.com; spf=pass (google.com: domain of jeremiah.dodds@gmail.com designates 10.68.210.12 as permitted sender) smtp.mail=jeremiah.dodds@gmail.com; dkim=pass header.i=jeremiah.dodds@gmail.com Original-Received: from mr.google.com ([10.68.210.12]) by 10.68.210.12 with SMTP id mq12mr44819071pbc.2.1329593645201 (num_hops = 1); Sat, 18 Feb 2012 11:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type:content-transfer-encoding; bh=JjhCabJjXaApI9qyexeJBzDLi92E7ZXH9jr8LWITue4=; b=wUNn+jQum/lfONZrZWKewJxLXkhgK0UXYq2vDKP7+nehlzFk1n5QOSTSBvqaBe0rt1 fuh4Sn98wsQ8zkqqJK8tkLCa8kGr20AUH/90cfQIfgCrnwxLlKzM8AGojsm/21R9VWSE JIGeBTIco+lhJOkVvSw9oPTEbB7yYrZvXlhf4= Original-Received: by 10.68.210.12 with SMTP id mq12mr36636069pbc.2.1329593645171; Sat, 18 Feb 2012 11:34:05 -0800 (PST) Original-Received: from destructor (ip98-180-233-170.cl.ri.cox.net. [98.180.233.170]) by mx.google.com with ESMTPS id q8sm8561655pbn.20.2012.02.18.11.34.01 (version=SSLv3 cipher=OTHER); Sat, 18 Feb 2012 11:34:04 -0800 (PST) In-Reply-To: (Steve Petersen's message of "Sat, 18 Feb 2012 12:52:15 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor 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 Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83791 Archived-At: Steve Petersen writes: > Hi emacs gurus,=20 > > [I accidentally posted this first to the main emacs forum, pardon my newb= ness.] > > I've spent hours scouring the web trying to solve what should be a simple > problem. =C2=A0I appreciate any help!=C2=A0=20 > > I want to replace a three-word phrase with an acronym. =C2=A0Should be ea= sy, right? > =C2=A0But of course I want to match across lines. =C2=A0From what I read = '\s-' should > match line feeds, but it doesn't. =C2=A0The closest I've gotten to matchi= ng across > lines is using 'foo[\s-^J]+bar' (using ^Q to insert ^J literally), but fo= r some > reason that doesn't=C2=A0match 'foo bar' on the same line! =C2=A0I'm out = of ideas - what's > going on? The following works for me with the words separated by arbitrary whitespace including newlines (although it is ugly, and I'm sure there's better ways to do it): M-x replace-regexp foo[ ^TAB^j]*bar[ ^TAB^j]*baz[ ^TAB^j] RET fbb RET Where ^TAB and ^j are C-qTAB and C-qC-j, on 24.0.93.8. I don't know, but I don't think that it should behave significantly differently on 23.