matcher.maches() return false
Why this code fails ?
Because of you think you do something like "Oh dear it contains the word!", but you're confuse matches with find
public boolean matches()
Attempts to match the entire region against the pattern.
So "/\.groovy/" is just a subsequence.
You must use