mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 17:08:31 +01:00
Added Negative Matching to conditional jumps so negative lookahead is not required.
This commit is contained in:
parent
47ce240e70
commit
7abda44fd6
2 changed files with 13 additions and 5 deletions
|
@ -201,8 +201,9 @@ const FlowControl = {
|
||||||
let ings = state.opList[state.progress].getIngValues(),
|
let ings = state.opList[state.progress].getIngValues(),
|
||||||
dish = state.dish,
|
dish = state.dish,
|
||||||
regexStr = ings[0],
|
regexStr = ings[0],
|
||||||
jumpNum = ings[1],
|
invert = ings[1],
|
||||||
maxJumps = ings[2];
|
jumpNum = ings[2],
|
||||||
|
maxJumps = ings[3];
|
||||||
|
|
||||||
if (jumpNum < 0) {
|
if (jumpNum < 0) {
|
||||||
jumpNum--;
|
jumpNum--;
|
||||||
|
@ -212,7 +213,9 @@ const FlowControl = {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regexStr !== "" && dish.get(Dish.STRING).search(regexStr) > -1) {
|
if (regexStr !== "") {
|
||||||
|
let strMatch = dish.get(Dish.STRING).search(regexStr) > -1;
|
||||||
|
if (!invert && strMatch || invert && !strMatch) {
|
||||||
state.progress += jumpNum;
|
state.progress += jumpNum;
|
||||||
state.numJumps++;
|
state.numJumps++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,11 @@ const OperationConfig = {
|
||||||
type: "string",
|
type: "string",
|
||||||
value: ""
|
value: ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Negative match (logical NOT)",
|
||||||
|
type: "boolean",
|
||||||
|
value: false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Number of operations to jump over if match found",
|
name: "Number of operations to jump over if match found",
|
||||||
type: "number",
|
type: "number",
|
||||||
|
|
Loading…
Reference in a new issue