import re


def _normalize_regex_patterns(regexes):
  """Normalizes a list of tokenizer regexes to a list of (regex, symbol)."""
  # g3doc breaks up patterns containing '|' when they are inserted into a table,
  # unless they're preceded by '\'.  Note that other special characters,
  # including '\', should *not* be escaped with '\'.
  return [(re.sub(r"\|", r"\\|", r.regex.pattern), r.symbol) for r in regexes]