Perhaps your point of view is obscured? Did you look into String.matches and see if it does what you think?
Have you looked at the Pattern class?
Have you tried to figure out if anything else would...