The same as #Scanner.match(), but returns the captured group rather than
    the regex match object, or None if the pattern didn't match.

def getmatch(self, regex, group=0, flags=0):
    """
    The same as #Scanner.match(), but returns the captured group rather than
    the regex match object, or None if the pattern didn't match.
    """

    match = self.match(regex, flags)
    if match:
      return match.group(group)
    return None