import re


def maxxmatches(regex, text, x):
    """Returns the substrings of length x from text, matching regex."""
    reg = re.compile(regex)
    result = reg.findall(text)
    return list(filter(lambda string: len(string) <= x, result))