I have values, which look like so:
Point_10_5_80_...
Point_22_21_77_...
Dots mean that pattern continues. Such values serve as templates in my code. And I want to be able to replace only second number in each template:
Point_10_5_80_... -> Point_10_777_80_...
Point_22_21_77_... -> Point_22_888_77_...
So, in first template 5 was replaced with 777 and in second template 21 was replaced with 888. I'm not sure how to implement this with preg_replace. I tried
$values = preg_replace('(Point_\d+_)(\d+)([_0-9]+)','$1' . $replacement . '$3', $template);
but in this case I just get empty values