http://qs321.pair.com?node_id=11133060


in reply to Regexp substitution on variable-length ranges with embedded code?

IF sequences are always consecutive and never interrupted, one could try to grab the first and the last of each sequence and replace each sequence in a loop.

BUT you need to be sure that neither

happens.

Still I wouldn't choose to embed Perl into a regex to solve that.

That's only complicating things, because the complex logic would be only obfuscated

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery