help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Nested Regexp's


From: Thorsten Jolitz
Subject: Nested Regexp's
Date: Tue, 18 Sep 2012 18:40:49 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]