protected String translateMaskCharIntoRegex(char c, boolean optional, boolean escapeFound) {
        String translated;

        if (escapeFound) {
            return String.valueOf(c);
        }
        else if (c == '[' || c == ']') {
            return Constants.EMPTY_STRING; //should be ignored
        }
        else if (c == '9') {
            translated = "[0-9]";
        }
        else if (c == 'a') {
            translated = "[A-Za-z]";
        }
        else if (c == 'A') {
            translated = "[A-Z]";
        }
        else if (c == '*') {
            translated = "[A-Za-z0-9]";
        }
        else if (REGEX_METACHARS.indexOf(c) >= 0) {
            translated = "\\" + c;
        }
        else {
            translated = String.valueOf(c);
        }
        return optional ? (translated + "?") : translated;
    }
Translates a single mask character into its corresponding regular expression snippet.

@param c the character to translate.
@param optional whether the character is within optional brackets ('[' and ']').
@param escapeFound whether the escape character ('\\') was found before this character.
@return the translated character as a regular expression snippet.
primefaces/src/main/java/org/primefaces/component/inputmask/InputMaskRenderer.java