In php I can check if a word is in a String like that
$muster = "/\b($word)\b/i";
if(preg_match($muster, $text)) {
return true;
}
Example:
$word = "test";
$text = "This is a :::test!!!";
Returns true
I tried converting this into Java:
if (Pattern.matches("(?i)\\b(" + word + ")\\b", text)) {
return true;
}
The same example :
String word = "test";
String text = "This is a :::test!!!";
would return false
What am I missing here? :(