Welcome to the Monastery | |
PerlMonks |
Using a regex capture as part of a varibleby nysus (Parson) |
on May 07, 2020 at 14:16 UTC ( [id://11116543]=perlquestion: print w/replies, xml ) | Need Help?? |
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";
Back to
Seekers of Perl Wisdom
|
|