I am not an expert with Regular Expression, so maybe this question has some basic implementation of regex.
First I have retrive some string from user wich has a format like this :
$id =3;
$format = {num}/sometext/sometext;
The question is how to replace {num}
with the variable of id, so the result will be :
3/sometext/sometext;
it's kinda like templating engine.
str_replace("{num}", $id, $format);
Couldn't you just use str_replace('{num}', $id, $format);
?