public static boolean containsWord(String word, String body) {
        // $ is quite a common character for a drools binding but it's not considered a word for the regexp engine
        // By converting to a character is easier to write the regexp
        final String wordWithDollarReplaced = word.replaceAll("\\$", "_DOLLAR_");
        final String bodyWithDollarReplaced = body.replaceAll("\\$", "_DOLLAR_");
        
        Pattern p = Pattern.compile("\\b" + wordWithDollarReplaced + "\\b", Pattern.UNICODE_CHARACTER_CLASS);
        return p.matcher(bodyWithDollarReplaced).find();
    }
@Test
    public void containsWordTest() throws Exception {
        assertThat(containsWord("$cheesery", "results.add($cheeseryResult);\n")).isFalse();
        assertThat(containsWord("$cheeseryResult", "results.add($cheeseryResult);\n")).isTrue();
        assertThat(containsWord("cheesery", "results.add($cheesery);\n")).isFalse();
    }