import re


def verifyFormat(ATS_LIST):
    """
    Matches a list of input ATS coordinates against the AltaLIS format in a regex.
    Returns True if any of the coordinates match the regex,
        False if none return.
    """
    # Defines a list of expressions to check against the coordinates.
    #   Anything in square brackets represents a range (i.e. [0-9][0-9] represents anything from 00-99)
    #   Anything in curly brackets represents a required number of items (i.e. [0-9][0-9]{1} will not pass if a number from 00-99 is not inputted)
    #   Anything outside of the brackets (ex. 'SEC-') are checked literally, and will only pass if they are in the expression in that position.
    #   *** Regex are great.
    #
    reList =    [   re.compile("^(TWP-[0-9][0-9][0-9]{1} RGE-[0-9][0-9]{1} MER-[4-7]{1})$"),
                    re.compile("^(SEC-[0-9][0-9]{1} TWP-[0-9][0-9][0-9]{1} RGE-[0-9][0-9]{1} MER-[4-7]{1})$"),
                    re.compile("^(QS-[neswNEWS]{2} SEC-[0-9][0-9]{1} TWP-[0-9][0-9][0-9]{1} RGE-[0-9][0-9]{1} MER-[4-7]{1})$"),
                    re.compile("^(LSD-[0-9][0-9]{1} SEC-[0-9][0-9]{1} TWP-[0-9][0-9][0-9]{1} RGE-[0-9][0-9]{1} MER-[4-7]{1})$")
                ]

    # Uses a broad sweeping check for the coordinates. This is mostly to check whether the right column was inputted.
    #   Returns True if any coordinates match any of the expressions.
    #   Returns False if none of the coordinates match.
    #
    if any(r.match(x) for x in ATS_LIST for r in reList):
        return True
    else:
        return False