import re


def FindSplitIndices(lines):
  """Given some lines representing a markdown file with multiple entries in it,
  find each split point."""

  def CodeLine(line):
    if line == '\n':
      return 'N'
    elif re.match('\w', line):
      return 'T'
    elif re.match('^===+$', line):
      return 'D'
    else:
      return '?'

  # Code lines: T if any text, N if new line, D if divider.
  coded_lines = [CodeLine(line) for line in lines]
  coded = ''.join(coded_lines)

  #warnings.warn(coded)

  # Look for patterns of NTDN in the coded lines string. If such a pattern is
  # found, output the index.
  return [m.start() for m in re.finditer('NTD', coded)]