pattern.matcher(String s)
returns a Matcher
that can find patterns in the String s
.
pattern.matches(String str)
tests, if the entire String (str
) matches the pattern.
In brief (just to remember the difference):
pattern.matcher
- test if the string contains a patternpattern.matches
- test if the string is a pattern