Bzzt! It will naturally return true for the second sentence, since the word the appears two times: The quick brown fox jumps over the lazy dog". Your second sentence still has the second the.
Your regex is correct. However, you'll need to use the Pattern.find method instead of matches, because matches attempts to match against the whole string. Pattern.find, on the other hand, will locate substrings that match your pattern.