class ResourceFileManager {

    static String createExtensionRegex(Set<String> fileExtensions) {
        StringBuilder validExtensions = new StringBuilder();
        for (Iterator<String> it = fileExtensions.iterator(); it.hasNext(); ) {
            String extension = it.next();
            if (it.hasNext())
                validExtensions.append(extension).append("|");
            else
                validExtensions.append(extension);
        }

        return ".*\\.(?i)(" + validExtensions + ")";
    }

}