Do you know where your variables are? | |
PerlMonks |
Re: Using a regex capture as part of a varibleby soonix (Canon) |
on May 07, 2020 at 15:08 UTC ( [id://11116548]=note: print w/replies, xml ) | Need Help?? |
Problem is, here, $1 is interpolated at the call to sed. That means: even before it is known if a match will occur and what will be matched. You could patch your copy of Rex::Commands::File to include /e flags for the two s/// operations in sed, but that is most certainly going to break other things.
In your case, it looks like you don't want to replace, anyway, but to insert. You could try whether turning your search pattern into a lookbehind might work.
In Section
Seekers of Perl Wisdom
|
|