* more general checksum highlighter

This commit is contained in:
Reinhard Pointner 2008-11-07 13:19:45 +00:00
parent 66cf786b19
commit e0d52fb515
2 changed files with 3 additions and 3 deletions

View File

@ -48,7 +48,7 @@ public final class FileBotUtil {
/**
* A {@link Pattern} that will match checksums enclosed in brackets ("[]" or "()"). A
* checksum string is a hex number with at least 8 digits. Capturing group 1 will contain
* checksum string is a hex number with at least 8 digits. Capturing group 0 will contain
* the matched checksum string.
*/
public static final Pattern EMBEDDED_CHECKSUM_PATTERN = Pattern.compile("(?<=\\[|\\()(\\p{XDigit}{8,})(?=\\]|\\))");
@ -60,7 +60,7 @@ public final class FileBotUtil {
// get last match
while (matcher.find()) {
embeddedChecksum = matcher.group(1);
embeddedChecksum = matcher.group(0);
}
return embeddedChecksum;

View File

@ -39,7 +39,7 @@ class HighlightPatternCellRenderer extends DefaultTableCellRenderer {
StringBuffer htmlText = new StringBuffer("<html><nobr>");
while (matcher.find()) {
matcher.appendReplacement(htmlText, "<span style='font-size: " + cssFontSize + ";" + (!isSelected ? "color: " + cssColor + ";" : "") + "'>$1</span>");
matcher.appendReplacement(htmlText, "<span style='font-size: " + cssFontSize + ";" + (!isSelected ? "color: " + cssColor + ";" : "") + "'>$0</span>");
}
matcher.appendTail(htmlText);