|go ahead... be a heretic|
Regexp substitution on variable-length ranges with embedded code?by Polyglot (Hermit)
|on May 26, 2021 at 11:02 UTC||Need Help??|
Polyglot has asked for the wisdom of the Perl Monks concerning the following question:
I have data in a format like this:
I'm attempting to condense these to ranges for every sequence in which the first two colon-delimited numbers are the same and the third numbers are in chronological sequence. For this range, my output should be:
The variability in potential sequence lengths is what is throwing me on this one. While I can match it with a regex expression, I don't know how to make the substitution with only the last matched number in the sequence, i.e., how to know which capture group is the last numbered capture.
Here is what I was trying:
This leaves me with the wrong output:
Am I attempting something beyond the bounds of regex?