IMHO you can do most of the work in one single regex with nested groupings, unfortunately I don't have the time until next week to fiddle out how exactly.
But most probably you'll get a faster response, since this is the monastery ... :)
Cheers Rolf
PS: but no guaranty that it's faster...
Comment on Re^2: Efficient walk/iterate along a string