Я использую регуляцию, чтобы найти, если на странице книги присутствует строка. Ниже приведен код для того же. < /p>
String regex = ".*\\b.{0}" + searchText + ".{0}.*\\b";
Pattern pattern = Pattern.compile(regex);
pattern.matcher("This is the text area where I am trying to look for the particular text, which is in the variable searchText. This text will have the string (222M) as part of this string. The find method should give me a true result even if I don't enter the closing brakect of the word. This is a multiline string").find()
< /code>
Наблюдения: < /p>
case 1: когда searchtext = "(222m)" < /li>
Результат: string найден. />
Я получаю приведенное ниже исключение. В странице.>
Подробнее здесь: https://stackoverflow.com/questions/243 ... -exception