Preg_replace reverso
Eu tenho regex assim:
^page/(?P<id>\d+)-(?P<slug>[^\.]+)\.html$
e uma matriz:
$args = array(
'id' => 5,
'slug' => 'my-first-article'
);
Eu gostaria de ter função:
my_function($regex, $args)
que retornará este resultado:
page/5-my-first-article.html
Como isso pode ser alcançado?
Algo comohttps://docs.djangoproject.com/en/dev/ref/urlresolvers/#reverse