i am playing with one regular expression using Java programming language (JDK 1.6) and i am unable to understand how (rather why!) it works.
here is my code
String text = "I am also known as John,PP)";
String pattern = "John([\\s\\u00A0)\\}\\]\"'-/\\\\.:;!'$?]|$)";
Matcher matcher = Pattern.compile(pattern,
Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE).matcher(text);
String foundString = matcher.group();
above code when executed prints "John,"
what i am unable to understand is ... though the pattern does not have
any comma (,) why the string "John," is getting matched ???
any help would be really appreciated ....