Ok. I know that i am missing something. I am just not able to find out what I am missing. The below mentioned pattern matches "|" and i don't know why. Can someone please explain. thanks. I want to match a single character. The character set is {,},[,],|,? etc.
public static void main(String[] args) {
String str = "";
if (str.matches("[\"|`|+|,|;|<|>|?|\\[|\\]|{|}|']"))
System.out.println("matches");
}