|
Named Groups
Part of Python's regular expression, but not Perl's
>>> pat = re.compile(r"(?P<name>\w+) (?P<age>\d+)")
>>> matches = pat.match("Maggie 2")
>>> print matches.group("name")
Maggie
>>> print matches.group("age")
2
>>>
Here's a named group regular expression for the AC line
AC (?P<ac_number>\w+);( (?P<ac_number>\w+);)*
|
|