mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-22 15:56:16 -04:00
Tweaks to 'Filter' operation.
This commit is contained in:
parent
ca87d54aa2
commit
216d8f1f7a
6 changed files with 27 additions and 26 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1765,8 +1765,9 @@ const OperationConfig = {
|
|||
]
|
||||
},
|
||||
"Filter": {
|
||||
description: "Filter the string with an regular expression",
|
||||
description: "Splits up the input using the specified delimiter and then filters each branch based on a regular expression.",
|
||||
run: StrUtils.run_filter,
|
||||
manual_bake: true,
|
||||
input_type: "string",
|
||||
output_type: "string",
|
||||
args: [
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
206 source files
|
||||
113411 lines
|
||||
113462 lines
|
||||
4.2M size
|
||||
|
||||
137 JavaScript source files
|
||||
104253 lines
|
||||
104304 lines
|
||||
3.7M size
|
||||
|
||||
79 third party JavaScript source files
|
||||
|
@ -11,11 +11,11 @@
|
|||
3.0M size
|
||||
|
||||
58 first party JavaScript source files
|
||||
19201 lines
|
||||
724K size
|
||||
19252 lines
|
||||
728K size
|
||||
|
||||
3.4M uncompressed JavaScript size
|
||||
1.8M compressed JavaScript size
|
||||
|
||||
15 categories
|
||||
158 operations
|
||||
159 operations
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue