David Coello wrote:I am not sure if to use a match regex function or contains function.
Well, personally, I'm not a big fan of
matches(), because it usually
(a) Makes the regex longer and and more complex.
(b) Runs slower.
It's also not the default style for
grep, which is where we get regexes from.
I really wish they'd add a
String.includes() method that takes a regex but, until they do, the equivalent is
Matcher.find(). I suggest you read the API docs for more details.
HIH
Winston
PS:
String.contains() is probably
not what you want, since it doesn't use regexes; but you could use it for matching specific words (maybe).