> AAAAAXXXXXXXAAAXXXXXAXXXXAAAA
> becomes:
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
replacing "X" -> "a" for better demo
use v5.12.0; use warnings; my $in = 'AAAAAXXXXXXXAAAXXXXXAXXXXAAAA'; my $out = $in =~ s [ (?<=A) X+ (?=A) ] [ $& =~ tr/X/a/r ]gexr; say $in; say $out;
AAAAAXXXXXXXAAAXXXXXAXXXXAAAA AAAAAaaaaaaaAAAaaaaaAaaaaAAAA
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
simplified $1 to $&
In reply to Re: Replace all characters inbetween
by LanX
in thread Replace all characters inbetween
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |