Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the result when non greedy repetition is used on the pattern /a+?b/?

What will be the result when non greedy repetition is used on the pattern /a+?b/?
a) Matches the letter b preceded by the fewest number of a’s possible
b) Matches the letter b preceded by any number of a
c) Matches letter a preceded by letter b, in the stack order
d) Matches letter a present in the string

Answer: a
Explanation: Using non greedy repetition may not always produce the results you expect. /a+?b/ matches the letter b preceded by the fewest number of a’s possible.

Join The Discussion