1.

Which of the following matches nonword character using regular expression in java?(a) \w(b) \W(c) \s(d) \SThe question was asked during an interview.Question is from Regular Expression in portion Regular Expressions of Java

Answer» RIGHT ANSWER is (b) \W

The explanation is: \W matches nonword characters. [0-9], [A-Z] and _ (UNDERSCORE) are word characters. All other than these characters are nonword characters.


Discussion

No Comment Found

Related InterviewSolutions