From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Newsgroups: gmane.emacs.help Subject: Re: replacing phrases: matching line feeds in regular expressions, since \s- doesn't work Date: Sat, 18 Feb 2012 20:17:35 +0100 Message-ID: <87boow6je8.fsf@googlemail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1329592606 23970 80.91.229.3 (18 Feb 2012 19:16:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 18 Feb 2012 19:16:46 +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:16:46 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 1Rypm0-00052U-UG for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Feb 2012 20:16:45 +0100 Original-Received: from localhost ([::1]:56277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rypm0-0004N4-7w for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Feb 2012 14:16:44 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:39716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ryplv-0004LM-0t for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 14:16:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rypls-0005Im-IK for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 14:16:38 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:52902) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rypls-0005IQ-Aw for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 14:16:36 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ryplq-0004wJ-Ne for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 20:16:34 +0100 Original-Received: from e179041137.adsl.alicedsl.de ([85.179.41.137]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 18 Feb 2012 20:16:34 +0100 Original-Received: from quintfall by e179041137.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 18 Feb 2012 20:16:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: e179041137.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:aOcHkgovqWqS87mRiu49MQOSsEU= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:83790 Archived-At: Steve Petersen writes: > Hi emacs gurus, > > [I accidentally posted this first to the main emacs forum, pardon my > newbness.] > > I've spent hours scouring the web trying to solve what should be a > simple problem.  I appreciate any help!  > > I want to replace a three-word phrase with an acronym.  Should be > easy, right?  But of course I want to match across lines.  From what I > read '\s-' should match line feeds, but it doesn't.  The closest I've > gotten to matching across lines is using 'foo[\s-^J]+bar' (using ^Q to > insert ^J literally), but for some reason that doesn't match 'foo bar' > on the same line!  I'm out of ideas - what's going on? My uninformed and untested opinion is to just use M-x query-replace, since you want to replace a string with another string. Maybe it doesn't match when a line break is involved, but I would be surprised. Another possibility would be to use M-x regexp-builder, a tool that helps you to visualize the matches for your regexp. cheers -- Thorsten