I was trying to implement a case insensitive whole word searching pattern. I came up with the following pattern:
Pattern p = Pattern.Compile('(?i)'+Pattern.quote('af'));
Using it in the code below:
String datum= 'Looking into dataframe or DataFrame';
Pattern p = Pattern.Compile('(?i)'+Pattern.quote('af'));
Matcher m = p.matcher(datum);
while (m.find()) {
Integer s = m.groupCount();
for (Integer i = 0; i <= s; i++) {
System.debug(m.group(i));
}
}
It matches af, aF which are just part of word and is not an exact match.
Am I missing something?