in reply to Code expressions in regex refer to the regex group captured, by name / relative

perlretut answers most of your questions.

Previous and future ones.

Update

See also

https://perldoc.perl.org/perlvar#Variables-related-to-regular-expressions

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

update

see Re^2: Refer by relative way to regex group (eg. the last one)

  • Comment on Re: Code expressions in regex refer to the regex group captured, by name / relative