import re


def filename_sorting_key(string, regex=re.compile('(\d+)')):
    """Returns a key for sorting filenames containing numbers in a natural way.

    :param string: The input string
    :type string: str
    :param regex: compiled regular expression object
    :type regex: Pattern
    :return: key for sorting files
    :rtype: List[Union[str,int]]
    """
    return [int(text) if text.isdigit() else text.lower() for text in regex.split(string)]