From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Florian Kaufmann" Newsgroups: gmane.emacs.help Subject: Re: regexp question Date: 27 Sep 2006 00:58:10 -0700 Organization: http://groups.google.com Message-ID: <1159343890.543389.316230@k70g2000cwa.googlegroups.com> References: <9773EFADA4FF6C43A49824D50B1539A7018ACD3A@exbe04.intra.dlr.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1159346612 6974 80.91.229.2 (27 Sep 2006 08:43:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 27 Sep 2006 08:43:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Sep 27 10:43:31 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GSV07-0007bG-DD for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2006 10:42:43 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GSUyb-0004aB-S4 for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2006 04:41:09 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!k70g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: 194.209.139.160 Original-X-Trace: posting.google.com 1159343894 23977 127.0.0.1 (27 Sep 2006 07:58:14 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 27 Sep 2006 07:58:14 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k70g2000cwa.googlegroups.com; posting-host=194.209.139.160; posting-account=Z44m8A0AAADexMuhVGiPev7CXD9-sJX0 Original-Xref: shelby.stanford.edu gnu.emacs.help:142045 Original-To: help-gnu-emacs@gnu.org 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:37666 Archived-At: > i want to replace a block beginning with and ending with > , with a variable number of lines between with another > text block. ext block with a regular expression? I would use: \(.\|^J\)*? Where the ^J results from pressing C-q C-j. The details: Since the dot . does much any character but the newline, I use the construct \(.\|^J\) which now matches really any character. *? is the lazy version of the greedy *. Meaning that as few as possible are selected. This prevents from selecting too much. Only * instead of *? would much both of the following lines instead of only one. line1 line2 However, my regex fails to match nested tags. In the following example the match is which is not what you want. I don't know how to make a regular expression which would also support this case. I'm sure you would find the answer in the book "Mastering regular expressions" Flo