protected static String convertJavaScriptRegex(String jsRegex) {
        int start = 0;
        int end = jsRegex.length() - 1;
        if (jsRegex.charAt(0) == '/') {
            start = 1;
        }
        char endChar = jsRegex.charAt(end);
        if (endChar == 'i' || endChar == 'g') {
            end = end - 1;
        }
        return LangUtils.substring(jsRegex, start, end);
    }
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