From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.help Subject: Re: replacing phrases: matching line feeds in regular expressions, since \s- doesn't work Date: Sun, 19 Feb 2012 08:15:57 +0800 Message-ID: <87zkcfwude.fsf@ericabrahamsen.net> 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 1329610588 8800 80.91.229.3 (19 Feb 2012 00:16:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 19 Feb 2012 00:16:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Feb 19 01:16:28 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 1RyuRy-0005z7-9q for geh-help-gnu-emacs@m.gmane.org; Sun, 19 Feb 2012 01:16:27 +0100 Original-Received: from localhost ([::1]:39379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyuRx-0002WD-Fy for geh-help-gnu-emacs@m.gmane.org; Sat, 18 Feb 2012 19:16:21 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:47956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyuRs-0002Vw-02 for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 19:16:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RyuRq-00008U-SV for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 19:16:15 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:39273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RyuRq-00008P-Jt for help-gnu-emacs@gnu.org; Sat, 18 Feb 2012 19:16:14 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RyuRp-0005t5-Bf for help-gnu-emacs@gnu.org; Sun, 19 Feb 2012 01:16:13 +0100 Original-Received: from 114.250.104.166 ([114.250.104.166]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Feb 2012 01:16:13 +0100 Original-Received: from eric by 114.250.104.166 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 19 Feb 2012 01:16:13 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 28 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 114.250.104.166 User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:UDh9IBUs8m5AkLcyOThWgzyqOOM= 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:83797 Archived-At: On Sun, Feb 19 2012, Steve Petersen wrote: > 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? There are also char classes, which gives you [:space:], matching both space and tab (it would be really nice to have one class that matches space, tab and newline...). So you could do: "foo[[:space:]^J]bar[[:space:]^J]baz[[:space:]^J]?" That seems to work, though it's still ugly. -- GNU Emacs 24.0.93.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-02-16 on pellet