Yes. The regex engine uses backtracking and marks its location whenever it has to make a decision. If the first decision doesn't work out, it backtracks to the last marked point and uses the next possible decision. The ? regex operator is such a decision point and I guess that basically, the two possibilities for a match are:
and[012345]\d
So in this case, it would not get a match when trying /[012345]\d/ against 5, so it backtracks, and tries /\d/, which works.\d
In reply to Re^5: simple pattern match ?
by Corion
in thread simple pattern match ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |