fix #2629 add quoteReplacement
This commit is contained in:
parent
ce9d129d81
commit
b4f01b5f81
2 changed files with 5 additions and 1 deletions
|
@ -238,7 +238,7 @@ public class ViewHelper {
|
|||
final Matcher matcher = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE).matcher(value);
|
||||
final StringBuffer buf = new StringBuffer(value.length() + 100);
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(buf, highlightTagPre + matcher.group(0) + highlightTagPost);
|
||||
matcher.appendReplacement(buf, Matcher.quoteReplacement(highlightTagPre + matcher.group(0) + highlightTagPost));
|
||||
}
|
||||
matcher.appendTail(buf);
|
||||
return buf.toString();
|
||||
|
|
|
@ -369,5 +369,9 @@ public class ViewHelperTest extends UnitFessTestCase {
|
|||
document.put("title", "on 111 strong on aaaa");
|
||||
assertEquals("<strong>on</strong> 111 str<strong>on</strong>g <strong>on</strong> <strong>aaa</strong>a",
|
||||
viewHelper.getContentTitle(document));
|
||||
|
||||
querySet.add("$");
|
||||
document.put("title", "$test");
|
||||
assertEquals("<strong>$</strong>test", viewHelper.getContentTitle(document));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue