| A common mistake is to confuse the behavior of the matches() and
contains() methods. matches() tests to see if a string exactly
matches a pattern whereas contains() searches for the first pattern
match contained somewhere within the string. When used with a
PatternMatcherInput instance, the contains() method allows you to
search for every pattern match within a string by using a while loop.
|