I have to lookup for a word "age" and similar word in a text file.
I have following sentence :
String.contains always return true in each case. My requirement is to pass the first five sentence and it return false in last case.
I will solve this problem by writing some code which contains a bunch of string " age ", " age." , "ages", "aged", " age," etc..
Is there any better way to solve this problem.
If you use regex, you have to put all the possiblities.
string.matches("(?i).*\\bage[ds]?\\b.*");