private static void deleteFile(Path tempFile) {
        try {
            Files.delete(tempFile);
        }
        catch (Exception ex) {
            LOGGER.log(Level.WARNING, ex,
                    () -> String.format("Could not delete temporary file %s, will try to delete on JVM exit", tempFile.toAbsolutePath()));
            try {
                tempFile.toFile().deleteOnExit();
            }
            catch (Exception ex1) {
                LOGGER.log(Level.WARNING, ex1,
                        () -> String.format("Could not register temporary file %s for deletion on JVM exit", tempFile.toAbsolutePath()));
            }
        }
    }
Converts a JavaScript regular expression like '/(\.|\/)(gif|jpeg|jpg|png)$/i'
to the Java usable format '(\\.|\\/)(gif|jpeg|jpg|png)$'
@param jsRegex the client side JavaScript regex
@return the Java converted version of the regex
primefaces/src/main/java/org/primefaces/util/FileUploadUtils.java