Thanks, but you missed the part of my OP where I say that I also need that solution in Python.
Frankly, I can't understand your insistence on this point: why does the fact that you must solve the problem both in Perl and in Python imply that you have to use a (pre-5.10) regex? Because it's the least common functionality, maybe? If so, then I see the point: code once, use twice. But then I would consider yours bad lazyness since it's not guaranteed a priori that coding twice and more precisely with the best tools that each language will provide you respectively will not be overall less work than the other way round. Or else I've not understood your concerns at all.