Although there is a case of JavaScript handling groups differently, that's not the case here. You expression as defined matches two condition
1) The begining of the input
2) a string ending in two digits. (Note: not a two digit string but a string of any length ending in two digits)
The correct result for your test is always true because case 1 is always true of any string. The real question is why Java is returning false?
I think the expression you want is
^(|[0-9][0-9])$
Michael
"In theory, theory and practice are the same. In practice, they are not."
Albert Einstein