I am using regex
r="[^A-Za-z0-9]+";
to determine whether a string contains one or more characters except letters and numbers;
Then I tried the following:
Pattern.compile(r).matcher(p).find();
I tested:
! @
In most cases, it works except backsplash \ and caret ^.
eg.
String p = "abcAsd10^" (return false) String p = "abcAsd10\\" (return false)
What am I missing?
source share