i have these variables:

```
$pathPattern = '/catalog/{name}/{id}';
$pathRealUrl = '/catalog/test-product/12343';

```

The `$pathPattern` is dynamic, from a json file.
The `$pathRealUrl` is the url.

Now I need to create this two variables:

```
$name = 'test-product';
$id = 12343;

```

Note that the `$pathPattern` can have many variables
and also that `{name}` and `{id}` can have different name ( like `{xxx}` or `{pippo}` ), other sample:

```
$pathPattern = '/home/test/{hello}';
$pathRealUrl = '/home/test/alex';

```

The best way for archive this?