import re


def getmatches(datafilelist, regex=None):
    """Takes list of search strings + regex. Returns a list of match objects"""
    if not regex:
        regex = re.compile(
            r"""
            (?P<ftype>[A-Z0-9]{5})      # band type of data file
            _[a-z]+                     # sat id
            _d(?P<date>\d{8})           # acq date
            _t(?P<time>\d{7})           # granule start time UTC
            _e\d+                       # granule end time UTC
            _b(?P<orbit>\d+)            # orbit number
            _c\d+                       # file creation date/time
            _\w+.h5                     # more stuff
            """, re.X
        )
    return [regex.search(filename) for filename in datafilelist]