in reply to Re^2: How can I reduce this with a REGEX?
in thread How can I reduce this with a REGEX?

Which can probably be further reduced to:
$ cat 1078350.in 12-12 12-12-12 12-13-12-13 12-12-13-13 12-13-13-14 $ perl -pe '1 while s/(\d\d)(.*?)(?:-\1)/$1$2/g' 1078350.in 12 12 12-13 12-13 12-13-14

Replies are listed 'Best First'.
Re^4: How can I reduce this with a REGEX?
by misterperl (Friar) on Mar 17, 2014 at 14:54 UTC
    $ perl -pe '1 while s/(\d\d)(.*?)(?:-\1)/$1$2/g' 1078350.in thanks I like this construct, never saw it before.. You got my ++ vote...