mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Tweaks to 'Filter' operation.
This commit is contained in:
parent
ca87d54aa2
commit
216d8f1f7a
6 changed files with 27 additions and 26 deletions
|
@ -262,18 +262,18 @@ var StrUtils = {
|
|||
return sections.join(join_delim);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Filter by regex operation.
|
||||
* Filter operation.
|
||||
*
|
||||
* @author Mikescher (https://github.com/Mikescher | https://mikescher.com)
|
||||
*
|
||||
* @param {string} input
|
||||
* @param {Object[]} args
|
||||
* @returns {string}
|
||||
*/
|
||||
run_filter: function(input, args) {
|
||||
var delim = Utils.char_rep[args[0]];
|
||||
var reverse = args[2];
|
||||
var delim = Utils.char_rep[args[0]],
|
||||
reverse = args[2];
|
||||
|
||||
try {
|
||||
var regex = new RegExp(args[1]);
|
||||
|
@ -283,7 +283,7 @@ var StrUtils = {
|
|||
|
||||
const regex_filter = function(value) {
|
||||
return reverse ^ regex.test(value);
|
||||
}
|
||||
};
|
||||
|
||||
return input.split(delim).filter(regex_filter).join(delim);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue