mirror of
https://github.com/gchq/CyberChef
synced 2025-01-04 00:38:41 +00:00
Merge branch 'qistoph-RegexTooltip'
This commit is contained in:
commit
5155d0ed56
1 changed files with 10 additions and 1 deletions
|
@ -227,6 +227,7 @@ function regexList (input, regex, displayTotal, matches, captureGroups) {
|
|||
*/
|
||||
function regexHighlight (input, regex, displayTotal) {
|
||||
let output = "",
|
||||
title = "",
|
||||
m,
|
||||
hl = 1,
|
||||
i = 0,
|
||||
|
@ -241,8 +242,16 @@ function regexHighlight (input, regex, displayTotal) {
|
|||
// Add up to match
|
||||
output += Utils.escapeHtml(input.slice(i, m.index));
|
||||
|
||||
title = `Offset: ${m.index}\n`;
|
||||
if (m.length > 1) {
|
||||
title += "Groups:\n";
|
||||
for (let n = 1; n < m.length; ++n) {
|
||||
title += `\t${n}: ${m[n]}\n`;
|
||||
}
|
||||
}
|
||||
|
||||
// Add match with highlighting
|
||||
output += "<span class='hl"+hl+"'>" + Utils.escapeHtml(m[0]) + "</span>";
|
||||
output += "<span class='hl"+hl+"' title='"+title+"'>" + Utils.escapeHtml(m[0]) + "</span>";
|
||||
|
||||
// Switch highlight
|
||||
hl = hl === 1 ? 2 : 1;
|
||||
|
|
Loading…
Reference in a new issue