def ExtractGroup(regex, text, group=1):
  match = re.search(regex, text)
  if not match:
    raise NoMatchError('No match for pattern "{0}" in "{1}"'.format(
        regex, text))

  try:
    return match.group(group)
  except IndexError:
    raise IndexError('No such group {0} in "{1}".'.format(group, regex))
Extracts a float from a regular expression matched to 'text'.
dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/regex_util.py/ExtractGroup