From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: PJ Weisberg Newsgroups: gmane.emacs.help Subject: Re: regexp with match over multiple lines Date: Thu, 5 May 2011 13:05:29 -0700 Message-ID: References: <31548643.post@talk.nabble.com> <3266E1E3-8935-49EE-8102-212C84CBD81A@Web.DE> <31552210.post@talk.nabble.com> <31552810.post@talk.nabble.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1304625943 25093 80.91.229.12 (5 May 2011 20:05:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 5 May 2011 20:05:43 +0000 (UTC) Cc: "Help-gnu-emacs@gnu.org" To: AngusC Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu May 05 22:05:39 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QI4nq-0007Ov-26 for geh-help-gnu-emacs@m.gmane.org; Thu, 05 May 2011 22:05:38 +0200 Original-Received: from localhost ([::1]:55267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI4np-0001qZ-5t for geh-help-gnu-emacs@m.gmane.org; Thu, 05 May 2011 16:05:37 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:39873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI4nk-0001qR-Ca for Help-gnu-emacs@gnu.org; Thu, 05 May 2011 16:05:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QI4nj-0004lH-9E for Help-gnu-emacs@gnu.org; Thu, 05 May 2011 16:05:32 -0400 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:57341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QI4nj-0004l4-1Z for Help-gnu-emacs@gnu.org; Thu, 05 May 2011 16:05:31 -0400 Original-Received: by fxm18 with SMTP id 18so2225845fxm.0 for ; Thu, 05 May 2011 13:05:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=x+Dk/gQ+uEuYJgLwGnmFr5nVTfnGq6HLYUawQ/guRvk=; b=WuyS9eRKr5f/GW52+raTxompz4okN0u/LrUShyb7mVEkeKAUxmU/jeGW43gmDoGOjt 73kTvG/8SbmbcHNfAltkHtt0dBFJNqALRQcEc7TIGY4Da1euAWMoClNUNl+ie8dkU1I1 BOb84PkpZB5Efc4FKtxyZClZdziWsDFCNONP4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BzGHmxQTNOiuw0UbytxRtoxYsJV0XQSTjGJZqshsja41K2X57wQLzT7HuhKK16dA/l BwqatwVdC00mHPt/JqQj6WTh0LUkPJtG6NVEDRtOGu0NBKn5mLvLlQ7Yw00Y8c0HIKL/ CIFPlhJ4/5oUzNXwfdOGM0u8ld0rFcjShvdKI= Original-Received: by 10.223.7.8 with SMTP id b8mr3356110fab.19.1304625929056; Thu, 05 May 2011 13:05:29 -0700 (PDT) Original-Received: by 10.223.69.141 with HTTP; Thu, 5 May 2011 13:05:29 -0700 (PDT) In-Reply-To: <31552810.post@talk.nabble.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.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:80932 Archived-At: On Thursday, May 5, 2011, AngusC wrote: > and I am using: > =A0<\1\[CDATA.*^J*> > > But it doesn't make any replacement. =A0I used C-q C-j - ie typed those k= eys > when entering. That matches any number of characters that sren't newlines, followed by any number of newlines, before the '>'. The way to match any character including newlines was in the first reply you got: "\\(.\\|\n\\)" On Thursday, May 5, 2011, AngusC wrote: > > > Andreas R=F6hler wrote: >> (setq startstring "abc") >> (setq endstring "def") >> >> (defun my-start-end-delete () >> =A0 =A0" " >> =A0 =A0(interactive "*") >> =A0 =A0(let (beg) >> =A0 =A0 =A0(while (search-forward startstring nil (quote move) 1) >> =A0 =A0 =A0 =A0(setq beg (match-beginning 0)) >> =A0 =A0 =A0 =A0(when (search-forward endstring nil (quote move) 1) >> =A0 =A0 =A0 =A0 =A0(delete-region beg (match-end 0)))))) >> >> abcABCDEFdefAAAAAAAAAA -> AAAAAAAAAA >> >> > > I am thinking I probably need to learn lisp to have real power. =A0More r= egex > would probably help. Learning lisp isn't a bad thing, but the above code is really an example of why you should learn regular expressions. There's no reason the above should have taken more than one line. --=20 -PJ