Код: Выделить всё
if ( Pattern.matches(".*\\b" + key + "\\b.*", text) ) {
//matched
}
Теперь я хотел бы сделать обратный: определить, есть ли вводной текст в границе слова внутри . mutually-collaborative (CORRECT, there is a word boundary inside) and mutuallycollaborative (WRONG, as there is no word boundary inside).
If the boundary was a punctuation this will work:
if( Pattern.matches("\\p{Punct}", text) ) { //check punctuations
//has punctuation
}
< /code>
Я хотел бы проверить на наличие границ слов в целом, например, '-', и т. Д. < /p>
есть идея? < /p>
Подробнее здесь: https://stackoverflow.com/questions/354 ... boundaries