//Match and replace the result:
Matcher matcher = result.getSearchOptions().getRegexPattern().matcher(str.substring(result.getStart()));
if (matcher.find()) {
matcher.appendReplacement(sb, replacement);
int replaceLong = sb.length();
matcher.appendTail(sb);
str = str.substring(0, result.getStart()) + sb.toString();
result.getSearchOptions().setRegionStart(result.getStart() + replaceLong);
Lookup.getDefault().lookup(AttributeColumnsController.class).setAttributeValue(str, attributes, column);
return findNext(result);//Go to next search result