in reply to Re: Replace all characters inbetween
in thread Replace all characters inbetween

Hi Tux!
Thank you so much for the help!! If I may, can you take out one of the solutions, because I have hard time isolating one?
I tried this:
my $s = "AAAAAXXXXXXXAAAXXXXXAXXXXAAAAA"; $s =~s{A\K([^A]+)(?=A)} {"A" x length $1 }; print $s."\n";
but it does not print something proper.

Replies are listed 'Best First'.
Re^3: Replace all characters inbetween
by AnomalousMonk (Archbishop) on Jun 05, 2022 at 09:59 UTC
Re^3: Replace all characters inbetween
by AnomalousMonk (Archbishop) on Jun 05, 2022 at 10:10 UTC

    Just a general note for future reference: As a rule, "it doesn't work" is a very poor problem description. The code you posted is short enough that you could have listed its output and any warning/error messages, etc., as well. Please see Short, Self-Contained, Correct Example.


    Give a man a fish:  <%-{-{-{-<