nested grouping with regular expressions

ds2000 diablosystems2000 at yahoo.com
Mon May 24 02:51:55 EDT 2004


Hi,

Let regex be some regular expression, which contains groups.

The pattern that I am interested in is the form of "<(regex)*>" (i.e.
the list of some constantly repeating regular expression inside the <>
brackets.

Unfortunately,  re.match("<(..)*>", string).groups()  will return only
the groups correspond to the last occurence of (regex)

Is it possible to get a more tree-like group match (i.e. or at least a
list which will contain the groups of each regex occurence).

Thanks ahead,
ds



More information about the Python-list mailing list