import re


def _match_op(ops, regex):
  """Returns ops that match given regex along with the matched sections."""
  matches = []
  prog = re.compile(regex)
  for op in ops:
    op_matches = prog.findall(op)
    if op_matches:
      matches.append((op, op_matches[0]))
  return matches