Good day.
There is an expression
/(?P<name>[0-9]+)/
It creates a named link with the name name, but how to use it in the replacement string? That is, I would like something like
preg_replace($re, "\{name}", $text);
Option with \1
not to offer.
In Perl, this effect is achieved in this way:
s/(?P<name>[0-9]+)/$+{name}/
but $+
is a construction of the language itself, not regular expressions.
How to achieve this in PHP?
Added by
At random tried options:
\{name} \\{name} \k{name} \g{name} ${name} $name $+{name} %+{name}
We need an analogue of $ + in PHP variations.