convertFilenameToMatcher = function(filename) {
    const hashMatch = filename.match(/\[hash:(\d+)\]/);

    if (hashMatch === null) {
        return new RegExp(regexEscaper(filename));
    }

    const [hashString, hashLength] = hashMatch;

    return new RegExp(
        regexEscaper(filename)
            .replace(regexEscaper(hashString), `([a-z0-9_-]){${hashLength}}`)
    );
}
Returns a regex to use to match this filename

@param {string} filename Filename with possible [hash:8] wildcard
@returns {RegExp}