I am looking to remove any words containing "oil". I thought \b
grabs any word containing "oil" but seems to only replace the word itself:
String str = "foil boil oil toil hello";
str = str.replaceAll("\\boil\\b", "");
Output:
foil boil toil hello
Desired output:
hello