From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Nested Regexp's Date: Tue, 18 Sep 2012 18:40:49 +0200 Message-ID: <87627bp9m6.fsf@googlemail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1347988248 16437 80.91.229.3 (18 Sep 2012 17:10:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Sep 2012 17:10:48 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 18 19:10:53 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TE1Jz-00008D-TX for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Sep 2012 19:10:52 +0200 Original-Received: from localhost ([::1]:40475 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE1Jv-0007Ve-Ls for geh-help-gnu-emacs@m.gmane.org; Tue, 18 Sep 2012 13:10:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE0oA-0007my-Jn for help-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:38:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TE0o6-0002sF-JX for help-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:37:58 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:55506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE0o6-0002rt-Cw for help-gnu-emacs@gnu.org; Tue, 18 Sep 2012 12:37:54 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TE0o6-0004nU-ST for help-gnu-emacs@gnu.org; Tue, 18 Sep 2012 18:37:54 +0200 Original-Received: from g231235242.adsl.alicedsl.de ([92.231.235.242]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Sep 2012 18:37:54 +0200 Original-Received: from tjolitz by g231235242.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 18 Sep 2012 18:37:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: g231235242.adsl.alicedsl.de User-Agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:44Gx3nVid9K5kXQXXdsKqRCf0As= 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:86822 Archived-At: Hi List, I'm somehow stuck with a regexp I need for fontification purposes. This is the syntax: ,-------------------- | -{bar} ; list item | !{foo} ; bold `-------------------- These are examples of nesting bold text into list items: ,------------------------------------------------------------------- | -{foo bar foo bar} ; fontified as list item | -{!{bold} foo bar} ; bold fontified, list item text not | -{foo bar ; fontified as list item | foo bar} | -{foo bar !{hello ; 'hello bold' fontified, list item text not | bold} foo bar} `------------------------------------------------------------------- These are the regexps: ,-------------------------------------------------- | (defconst my-regex-list-item | "\\(-{\\)\\([ | ]*[^}]+\\)\\(}\\)" | "Regular expression for matching a list item.") | | (defconst my-regex-bold | "\\(!{\\)\\([ | ]*[^}]+\\)\\(}\\)" | "Regular expression for matching bold text.") `-------------------------------------------------- Now I would need to construct a 'my-regex-list-item' that allows for one or several nested 'bold' terms, with each the list item and the bold term possibly including line-breaks. The result should actually show the whole list item in the assigned color, and the bold terms in the same color, but bold. I would appreciate any hint about how to construct the list-item regexp in a way that it can contain nested bold terms. -- cheers, Thorsten