"aa" does not match. Should "aa" match?
"ab" does not match. Should it match?
No, it shouldn't because of ^ and $ in regular expressionm, which means begin and end of line including and the expression is evaluated as a whole. Your expression means begin-zero or just one chars-ends, but in these samples, the pattern is begin-first char-second char-end, which doesn't match, because the end of line is expected after max one char, not two.
Bookmarks