I have always had hard time understanding regular expressions. With the help of web searches i have always managed to pull through somehow. Guess i have never bothered to really learn then. Sorry.
But i need help with them yet again.
I have a dict like
d = {'account_id':a_value,'group_id':g_value,'other_id':o_value }
And i have bunch of strings like:
s1 = r'^settings/usergroups/(?P<group_id>\d+)/cargroups/$'
s2 = r'^settings/usergroups/(?P<group_id>\d+)/other/(?P<other_id>\d+)/$',
s3 = r'^settings/account/(?P<account_id>\d+)/other/(?P<other_id>\d+)/$',
How can O replace the (?P< group_id >\d+)
, (?P< account_id >\d+)
, (?P< other_id >\d+)
in the strings with matching values from dict?