import re


def group_match(regex, op_slices):
  """Returns True if the regex is found in the op name of any Opslice.

  Args:
    regex: A string regex.
    op_slices: List of OpRegularizerManager.OpSlice.

  Returns:
    True if the regex is found in the op name of any op in op_slices.
  """
  # If no regex, then group does not match.
  if not regex:
    return False

  # Check if any OpSlice in the group matches the regex.
  matches = [re.search(regex, op_slice.op.name) for op_slice in op_slices]
  return any(matches)