diff --git a/src/core/operations/A1Z26CipherDecode.mjs b/src/core/operations/A1Z26CipherDecode.mjs index cc9aafbf76..4cbe605da7 100644 --- a/src/core/operations/A1Z26CipherDecode.mjs +++ b/src/core/operations/A1Z26CipherDecode.mjs @@ -35,32 +35,32 @@ class A1Z26CipherDecode extends Operation { ]; this.checks = [ { - pattern: "^\\s*([12]?[0-9] )+[12]?[0-9]\\s*$", + pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]) )+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$", flags: "", args: ["Space"] }, { - pattern: "^\\s*([12]?[0-9],)+[12]?[0-9]\\s*$", + pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]),)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$", flags: "", args: ["Comma"] }, { - pattern: "^\\s*([12]?[0-9];)+[12]?[0-9]\\s*$", + pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]);)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$", flags: "", args: ["Semi-colon"] }, { - pattern: "^\\s*([12]?[0-9]:)+[12]?[0-9]\\s*$", + pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6]):)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$", flags: "", args: ["Colon"] }, { - pattern: "^\\s*([12]?[0-9]\\n)+[12]?[0-9]\\s*$", + pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6])\\n)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$", flags: "", args: ["Line feed"] }, { - pattern: "^\\s*([12]?[0-9]\\r\\n)+[12]?[0-9]\\s*$", + pattern: "^\\s*((?:0?[1-9]|1[0-9]|2[0-6])\\r\\n)+(?:0?[1-9]|1[0-9]|2[0-6])\\s*$", flags: "", args: ["CRLF"] } diff --git a/tests/operations/tests/Magic.mjs b/tests/operations/tests/Magic.mjs index 90401dc19c..59486454a8 100644 --- a/tests/operations/tests/Magic.mjs +++ b/tests/operations/tests/Magic.mjs @@ -152,5 +152,49 @@ TestRegister.addTests([ args: [1, false, false] } ] + }, + { + name: "Magic: invalid zero A1Z26 values do not match", + input: "0,0", + unexpectedMatch: /A1Z26 Cipher Decode/, + recipeConfig: [ + { + op: "Magic", + args: [0, false, false] + } + ] + }, + { + name: "Magic: invalid high A1Z26 values do not match", + input: "27,1", + unexpectedMatch: /A1Z26 Cipher Decode/, + recipeConfig: [ + { + op: "Magic", + args: [0, false, false] + } + ] + }, + { + name: "Magic: valid leading-zero A1Z26 values match", + input: "26,01", + expectedMatch: /A1Z26 Cipher Decode/, + recipeConfig: [ + { + op: "Magic", + args: [0, false, false] + } + ] + }, + { + name: "Magic: valid leading-zero A1Z26 values match with two digits", + input: "09,10", + expectedMatch: /A1Z26 Cipher Decode/, + recipeConfig: [ + { + op: "Magic", + args: [0, false, false] + } + ] } ]);