https://docs.python.org/2/howto/regex.html#regex-howto
named group is just an extension of regular expression group by adding the prefix ?P<group-name> in the beginning of the left parenthesis: example:
str = my name is hello !
pattern = ^my\s(?P<group-name>\w\w\w\w)\s.+
match.group('group-name') = name
No comments:
Post a Comment