Then your line is not as you have shown it. Have you carefully counted the '-' characters? Have you carefully checked the number of spaces? Have you checked for trailing or leading spaces? You don't show the rest of your code so we can't tell if you are actually using the Matcher object correctly. P.S. You don't need the leading ^ ...