I have string
$string = 'foo/{id}/bar/{name}';
and I am trying to do regex filtering
wanted output:
$matches = [
0 => 'foo/{id}/bar/{name}',
1 => 'id',
2 => 'name'
]
I got so far: (regex is my weakness)
preg_match('~^' . $magic . '$~', $string, $matches)
edit: there are *n number of {variable} in url