Regular Expressions


  1. groupCount reports a total number of Capturing groups.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    groupCount reports total number of Capturing groups. this does not include special group, group 0.


  1. Which capturing group can represent the entire expression?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Group 0 is a special group which represents the entire expression.



  1. Object of which class is used to compile regular expression?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    object of Pattern class can represent compiled regular expression.


  1. What is the significance of Matcher class for regular expression in java?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    macther() method is invoked using matcher object which interpretes pattern and performs match operations in the input string.



  1. Which of the following is not a class of java.util.regex?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    java.util.regex consists 3 classes. PatternSyntaxException indicates syntax error in regex.