Im actively practicing with php regex and got stuck with a replace function as it shows absolutely different results from tutorial I copied it from.
So the function preg_replace('/\{([a-z]+)\}/', '(?P<\1>[a-z-]+)', '{controller}\/{action}')
should give me this result in the output: (?P<controller>[a-z-]+)\/(?P<action>[a-z-]+)
. phpliveregex.com confirms that https://www.phpliveregex.com/p/wIF
However, this is what my browser on my localhost is outputing me in fact: (?P[a-z-]+)\/(?P[a-z-]+)
.
How is that possible? Is my php broken or the preg_replace function is working differentely now? My php version is 7.4.4