You will probably get a warning, but there is an outside chance that sed qr{("name": "$section",\n.*\n.*)}, '\\1' . $json, $groups_file, multiline => TRUE might work.
For compatibility, Perl also recognizes '\N' for one-digit N in regex substitutions if there are sufficient capture groups in the pattern.
In reply to Re: Using a regex capture as part of a varible
by jcb
in thread Using a regex capture as part of a varible
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |