Not setting the name to preg_replace.What's the problem?

Faced with the problem when you review small router.
Adding routes goes formatting pattern,in fact in php sandbox everything works fine,but on the server and on the LAN - not passdataset variable
$pattern = preg_replace('/\//', '\\/', $uri);
$pattern = preg_replace('/\{([a-z]+)\}/', '(?/P<\1>[a-z]+)', $pattern);
$route = preg_replace('/\{([a-z]+):([^\}]+)\}/', '(?P<\1>\2)', $pattern);

Type of router contrl/action/{someid}
The latter goes in a pattern
April 3rd 20 at 17:35
1 answer
April 3rd 20 at 17:37
and why (?/P ?

P put all

Find more questions by tags PHP