nysus has asked for the wisdom of the Perl Monks concerning the following question:
I'm throwing in the towel in this one. I'm trying to use this Rex sed function.
I want to be able to capture the match on the left and insert it back into the replacement pattern with $1 but nothing I've tried works. I know I'm missing something simple. Here's my latest iteration:
sed qr{("name": "$section",\n.*\n.*)}, '$1' . $json, $groups_file, multiline => TRUEBut this just inserts "$1" into the file before the $json. If I do:
$1$json
The $1 is empty. Presumably because it is replaced with '' during runtime.
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using a regex capture as part of a varible
by soonix (Canon) on May 07, 2020 at 15:08 UTC | |
by nysus (Parson) on May 07, 2020 at 15:20 UTC | |
Re: Using a regex capture as part of a varible
by Fletch (Bishop) on May 07, 2020 at 14:39 UTC | |
by nysus (Parson) on May 07, 2020 at 14:49 UTC | |
by hippo (Bishop) on May 07, 2020 at 15:05 UTC | |
Re: Using a regex capture as part of a varible
by jcb (Parson) on May 07, 2020 at 23:43 UTC |
Back to
Seekers of Perl Wisdom