Regular Expressions


  1. What does public int start() return?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    public int start() returns index of the previous match in the input string.


  1. what does public String replaceAll(string replace) do?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    replaceAll method replaces every subsequence of the sequence that matches pattern with a replacement string.



  1. What does public int end(int group) return?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    public int end(int group) returns offset from the last character of the subsequent group.


  1. Which of the following matches end of the string using regular expression in java?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    \z is used to match end of the entire string in regular expression in java.



  1. Which of the following matches nonword character using regular expression in java?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

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