mardi 16 avril 2019

When will following code throw PatternSyntaxException?

I want following code to throw PatternSyntaxException. Can someone help me as to what should be passed in strPassed and strToMatch so that this PatternSyntaxException is thrown?

private static int patternMatch(String strPassed, String strToMatch) throws PatternSyntaxException {
        Matcher matcher;
        matcher = Pattern.compile("[" + Pattern.quote(strToMatch) + "]+").matcher(strPassed);
        return 10;
    }

Aucun commentaire:

Enregistrer un commentaire