Does anyone know why these two code snippets output different things? The first outputs "tes" which is what I would expect. The second outputs "test" which implies the regular expression doesn't match.
According to the JavaDoc for the
String class, these are supposed to be identical. Am I doing something wrong when transposing?
They both work correctly if I remove the $. Then both output "es".