I want to create a Regex pattern that uses a variable (String key in HashMap) and ignores case sensitivity that I can use in a replaceAll() call. So far I have managed to isolate the word using \b, but don't know how to incorporate case insensitivity in the regex pattern.
If the String variable is "the", I would like for "The" and "THE" to also be matched by the pattern. How would I go about this? What I have so far:
String pattern ="\\b" + entry.getKey()+ "\\b";
extractedText = extractedText.replaceAll(pattern,"foo" + entry.getKey());
Very thankful for any help!