in reply to Re^2: What is the output for this ??
in thread What is the output for this ??

The output of your program is
Beginning is <I have >,number is <2>.
The ".*+?" matches non greedily(Because of the ?), so the next "\d+" matches the first digit(s) it encounters, which is "2".

This means that the first expression (.*+?) gets everything before the "2".

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis