in reply to Re: Is there any other way to avoid greedy matching
in thread Is there any other way to avoid greedy matching

/^\d\d$/ will also allow a trailing newline.
/^\d\d\z/ checks if the string contains exactly two digits and nothing else

Yes, there are other ways, but they are more complicated.