As you may (or not) know, you can reference a capture group with:
$1
1
being the group number.
In the same way, you can reference a named capture group with:
${name}
\{name}
g\{name}
Let's take the preceding example and replace the matches with
The hero of the story is a ${subject}.
The result we will obtain is:
The hero of the story is a pretty little girl.
The hero of the story is a unicorn with an hat.
The hero of the story is a boat with a pirate flag.