Using a regex as a template with Python
15:46 08 Sep 2010

I have the idea to use a regex pattern as a template and wonder if there is a convenient way to do so in Python (3 or newer).

import re

pattern = re.compile("/something/(?P.*)")
pattern.populate(id=1) # that is what I'm looking for

should result in

/something/1
python regex templates