Hi

I wonder if python has a function to pack things back into regexp,
that has group names.

e.g:
exp = (<?P<name1>[a-z]+)
compiledexp = re.compile(exp)

Now, I have a dictionary "mytable = {"a" : "myname"}

Is there a way in re module, or elsewhere, where I can have it match
the contents from dictionary to the re-expression (and check that it
matches the rules) and than return the substituted string?

e.g
>> re.SomeNewFunc(compilexp, mytable)
"myname"
>> mytable = {"a" : "1"}
>> re.SomeNewFunc(compileexp, mytable)
ERROR



Thanks
A
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to