I need to match a phrase exactly as it is.Example:
This is a sentance with my phrase in it.My phrase is here, this is another sentance with my phrase.This is the last sentance with my phrase.
In the above example, I got the following regex to work for all cases except the third one :
Pattern pattern = Pattern.compile("(\\.?)(\\b?)"+lexicon+"\\b(?!\\.)");
Matcher matcher = pattern.matcher(text);
Can someone point out how to get the missing case working.