import re


def get_raw_front_matter(source_text):
    """
    Tries to find front matter in the beginning of the document and
    returns it as a string.
    """
    matches = list(re.finditer(r"(---\n)", source_text))
    if len(matches) >= 2:
        front_matter_start = matches[0].start(1)
        front_matter_end = matches[1].start(1)
        return source_text[(front_matter_start + 4):front_matter_end]
    return ""