The following is throwing an exception:
Pattern.matches(""+input.charAt(i),"\\s");
java.util.regex.PatternSyntaxException:
Unclosed character class near index 0.
I don’t understand why. Does the text I am matching against also need to have escaped characters?
Screenshot of workspace in case it helps.
You got the parameters in the wrong order (from the documentation)