Home / CSE / Javascript - CS :: Discussion

Discussion :: Javascript - CS

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

  2. 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.

     None of the mentioned

    View Answer

    Workspace

    Answer : Option 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.


Be The First To Comment