In Java, String.match() conveniently takes a regular expression, not just an ordinary String. However, I just found the following:
// returns true; good
// returns false -- huh???
Turns out it looks like matches() is anchored; it's implicitly acting as if the regular expression is wrapped in ^ and $. So the regular expression I supply to matches() has to consume the entire string, from beginning to end, or it doesn't match. Sigh.
// returns true -- sigh
This of course is not specified in the documentation anywhere that I can see. At least, not in the Javadocs for the String.matches() method.