import re


def make_regex(pattern, guard_symbol=None):
    """
    Performs a few substitutions so the pattern can use format-style
    shorthands, then compiles and returns the regex.
    """
    replacements = {
        's' : r"[ \t]", # space characters
        'guard' : guard_symbol
    }
    return re.compile(pattern.format(**replacements), re.MULTILINE)