def reglob(path, exp, invert=False):
    """glob.glob() style searching which uses regex
    :param exp: Regex expression for filename
    :param invert: Invert match to non matching files
    """
m = re.compile(exp)
if invert is False:
    res = [f for f in os.listdir(path) if m.search(f)]
else:
    res = [f for f in os.listdir(path) if not m.search(f)]
res = map(lambda x: '%s/%s' % (path, x), res)
return res
использование регулярного выражения в glob.glob python