Help needed: Handling the search result of mxTextTool

Pekka Niiranen krissepu at
Sat Jun 8 20:56:41 CEST 2002

After running mxTextTool + Simpleparse search of nested
parameters to single line I got  result like this:

(1, [('match', 2, 12, [('match', 5, 9, [])])], 14)

which means there has been two nested matches in searched string
(of 14 characters in total) and they are at slices [2:12] and [5:9].

Now I have to traverse the tuple/list -structure recursively to
build the strings again, since I am collecting the matched
strings instead of their slice positions. I am afraid this (post-)
nulls the speed benefits gained by using mxTextTools.

Does anybody know a parameter in mxTextTools or a FAST
recursive function (no for loops please !) to help mxTextTools
to return the matched strings in a tuple or a list ( [a[2:12], a[5:9]) ?


More information about the Python-list mailing list