With this call,
System.out.println(Pattern.matches("[c&&c]", "c"));
I got true
. However, with this call,
System.out.println(Pattern.matches("c&&c", "c"));
I got false
. The second call does not get any exceptions thrown, which means it's a valid regular expression. However, I'm not sure that's acceptable because, in Java API, the operator &&
seems to only occur between brackets. Then, what's the meaning of &&
in the second call?