Message-ID: <736529763.2557.1430774268374.JavaMail.email@example.com> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_2556_1307163339.1430774268373" ------=_Part_2556_1307163339.1430774268373 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Why does this code fail?
Because you think you do something like "Oh dear it contains th= e word!", but you're confusing matches with find
public boolean matches()
Attempts to match the entire region ag= ainst the pattern.
So "/\.groovy/" is just a subsequence.
You must= use
A pattern is not very useful alone. He's just waiting input to process t= hrough a matcher.
Matcher can say a lot of thing to you:
<= a href=3D"http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Matcher.h= tml#matches()" class=3D"external-link" rel=3D"nofollow">matcher.matches()= a>;
A matcher with /groovy/ pattern finds a matching subseq=
uence in the 'my groovy buddy' sequence.
On the contrary the whole se= quence doesn't match the pattern.
Application: to filter a list of names.
A little tilde headache ? Remember like this
roughly as the pattern (easy to write)
more than roughly, exactly a= s the pattern (think hard...)