Код: Выделить всё
String expression="a weird case of {asda}something";
Pattern aPattern=Pattern.compile("\\{(.*?)\\}");
Matcher matcher = aPattern.matcher(expression);
boolean match = matcher.matches();
< /code>
Это всегда будет бросать < /up>
Exception in thread "main" java.lang.IllegalStateException: No match found
< /code>
Я не понимаю, почему он не найдет совпадения. Вывод должен быть {asda}
Подробнее здесь: https://stackoverflow.com/questions/257 ... nd-a-match