From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Peter Dyballa Newsgroups: gmane.emacs.help Subject: Re: multiline regex mode? Date: Sat, 25 Nov 2006 14:14:05 +0100 Message-ID: <6EFCA005-F27F-43D1-9005-EE8127118334@Web.DE> References: <87u00o1r9r.fsf@hans.local.net> <87lkm01b6y.fsf@hans.local.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1164460506 27761 80.91.229.2 (25 Nov 2006 13:15:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 25 Nov 2006 13:15:06 +0000 (UTC) Cc: GNU Emacs List Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Nov 25 14:15:04 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 1GnxN0-0007mF-0e for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Nov 2006 14:15:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GnxMz-0007sH-Dm for geh-help-gnu-emacs@m.gmane.org; Sat, 25 Nov 2006 08:15:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GnxMC-0007HB-TL for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 08:14:13 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GnxMC-0007Fs-06 for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 08:14:12 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GnxMB-0007FM-Ha for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 08:14:11 -0500 Original-Received: from [217.72.192.221] (helo=fmmailgate01.web.de) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GnxMA-0003oI-Q6 for help-gnu-emacs@gnu.org; Sat, 25 Nov 2006 08:14:11 -0500 Original-Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate01.web.de (Postfix) with ESMTP id 1DA583DAC7D3; Sat, 25 Nov 2006 14:14:10 +0100 (CET) Original-Received: from [87.193.40.237] (helo=[192.168.1.2]) by smtp07.web.de with asmtp (TLSv1:AES128-SHA:128) (WEB.DE 4.107 #114) id 1GnxM9-0001Px-00; Sat, 25 Nov 2006 14:14:10 +0100 In-Reply-To: <87lkm01b6y.fsf@hans.local.net> X-Image-Url: http://homepage.mac.com/sparifankal/.cv/thumbs/me.thumbnail Original-To: Dieter Wilhelm X-Mailer: Apple Mail (2.752.2) X-Sender: Peter_Dyballa@web.de 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:38973 Archived-At: Am 25.11.2006 um 04:01 schrieb Dieter Wilhelm: >> So "{[^}]*}" stands for 'a region that starts with `{=B4 and has no = `}=B4 >> until the final `}=B4 is hit; between both braces any number = (starting >> with 0) of any character except `}=B4 can appear.' > > Thanks Peter for the hassle. Maybe I expressed myself in a confusing > manner: The period and the character alternatives I understand. What > I really wanted to know is where to look for a possibility of > searching for *balanced* brackets like { { } } because I'll need this > in my own Elisp stuff. It's clear that there is some code in Emacs > for it (e. g. C-M-f etc.) but I have a hunch that there might be > something else out there. Maybe a regexp extension in Perl or ... I think you can't use one regular expression for a variety of nested =20 "*balanced* brackets like { { } }". A simple regexp would be: find a region that starts after `{=B4 and has =20= neither `}=B4 nor `{=B4 until it reaches the first `}=B4: {[^{}]*} It's obvious that it can't find your case. Before and after the =20 previous case from above this previous case has to be repeated. Let's =20= try this: {[^{}]*=B7{[^{}]*}=B7[^{}]*} ; the =B7 might help to = understand, they are =20 not meant to be parts of the regexp! So remove them before trying to =20 use it! { and no { or }, then { and no { or }, then }, and no { or }, but a =20 final }. You can find the { { { } } } case ... or the { { } { } } case or ... =20 And you would need to find an algorithm in which sequence to apply them! Perl won't help. It has the same restrictions (or it wouldn't handle =20 basic or extended regular expressions). It's only possible to use a =20 more complicated syntax that less people would try to understand. -- Mit friedvollen Gr=FC=DFen Pete Windows, c'est un peu comme le beaujolais nouveau: =E0 chaque nouvelle =20= cuv=E9e on sait que ce sera d=E9gueulasse, mais on en prend quand m=EAme, = =20 par masochisme.