Get named groups from a regular expression

Florian Lindner mailinglists at xgm.de
Tue Jul 1 17:12:34 CEST 2014


Hello,

Is there a way I can extract the named groups from a regular expression? 
e.g. given "(?P<testgrp>\d)" I want to get something like ["testgrp"].

OR

Can I make the match object to return default values for named groups, even 
if no match was produced?

Thanks,
Florian




More information about the Python-list mailing list