public String setNewDescription(String descriptions) {
String message = "this is message";
Pattern filter = Pattern.compile("<div class=\"item-description\".*?>[\\s\\S]*?</div>", Pattern.CASE_INSENSITIVE);
Matcher filterMatcher = filter.matcher(descriptions);
String content = null;
if(filterMatcher.find()) {
content = filterMatcher.group();
}
StringBuffer sb = new StringBuffer(content);
sb.insert(content.lastIndexOf("</div>"), message);
return descriptions.replaceAll("<div class=\"item-description\".*?>[\\s\\S]*?</div>", sb.toString());
}
String message = "this is message";
Pattern filter = Pattern.compile("<div class=\"item-description\".*?>[\\s\\S]*?</div>", Pattern.CASE_INSENSITIVE);
Matcher filterMatcher = filter.matcher(descriptions);
String content = null;
if(filterMatcher.find()) {
content = filterMatcher.group();
}
StringBuffer sb = new StringBuffer(content);
sb.insert(content.lastIndexOf("</div>"), message);
return descriptions.replaceAll("<div class=\"item-description\".*?>[\\s\\S]*?</div>", sb.toString());
}