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
- neither 43:1:1; 43:1:2; 43:1:5; 43:1:6;
- nor 43:1:1; 43:1:2; 27:3:7; 43:1:3; 43:1:4;
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
|
---|
In Section
Seekers of Perl Wisdom