mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Caching added for Magic regexes
This commit is contained in:
parent
570a84b67a
commit
5b5105c864
1 changed files with 4 additions and 5 deletions
|
@ -36,10 +36,10 @@ class Magic {
|
||||||
const matches = [];
|
const matches = [];
|
||||||
|
|
||||||
for (let i = 0; i < opPatterns.length; i++) {
|
for (let i = 0; i < opPatterns.length; i++) {
|
||||||
const pattern = opPatterns[i],
|
const pattern = opPatterns[i];
|
||||||
regex = new RegExp(pattern.match, pattern.flags);
|
|
||||||
|
|
||||||
if (regex.test(this.inputStr)) {
|
|
||||||
|
if (pattern.match.test(this.inputStr)) {
|
||||||
matches.push(pattern);
|
matches.push(pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,8 +522,7 @@ class Magic {
|
||||||
OperationConfig[op].input.regex.forEach(pattern => {
|
OperationConfig[op].input.regex.forEach(pattern => {
|
||||||
opCriteria.regex.push({
|
opCriteria.regex.push({
|
||||||
op: op,
|
op: op,
|
||||||
match: pattern.match,
|
match: new RegExp(pattern.match, pattern.flags),
|
||||||
flags: pattern.flags,
|
|
||||||
args: pattern.args,
|
args: pattern.args,
|
||||||
useful: pattern.useful || false
|
useful: pattern.useful || false
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue