escape nick in highlight regex pattern

This commit is contained in:
Daniel Gultsch 2015-04-28 09:32:58 +02:00
parent f8e06d8e9a
commit b10b8e2c50
1 changed files with 1 additions and 1 deletions

View File

@ -454,7 +454,7 @@ public class NotificationService {
// nick (matched in case-insensitive manner), followed by optional
// punctuation (for example "bob: i disagree" or "how are you alice?"),
// followed by another word boundary.
return Pattern.compile("\\b" + nick + "\\p{Punct}?\\b",
return Pattern.compile("\\b" + Pattern.quote(nick) + "\\p{Punct}?\\b",
Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
}