From 3a2f2c7344609837869ed4a911d3beb2d0f095c9 Mon Sep 17 00:00:00 2001 From: Thomas <31802793+ThomasNotTom@users.noreply.github.com> Date: Thu, 5 Jun 2025 23:39:42 +0100 Subject: [PATCH 1/2] Include odd numbered bytes in RegEx --- src/core/operations/FromHexdump.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/operations/FromHexdump.mjs b/src/core/operations/FromHexdump.mjs index e8c25441..b8186c76 100644 --- a/src/core/operations/FromHexdump.mjs +++ b/src/core/operations/FromHexdump.mjs @@ -43,7 +43,7 @@ class FromHexdump extends Operation { */ run(input, args) { const output = [], - regex = /^\s*(?:[\dA-F]{4,16}h?:?)?[ \t]+((?:[\dA-F]{2} ){1,8}(?:[ \t]|[\dA-F]{2}-)(?:[\dA-F]{2} ){1,8}|(?:[\dA-F]{4} )*[\dA-F]{4}|(?:[\dA-F]{2} )*[\dA-F]{2})/igm; + regex = /^\s*(?:[\dA-F]{4,16}h?:?)?[ \t]+((?:[\dA-F]{2} ){1,8}(?:[ \t]|[\dA-F]{2}-)(?:[\dA-F]{2} ){1,8}|(?:[\dA-F]{4} )*[\dA-F]{2,4}|(?:[\dA-F]{2} )*[\dA-F]{2})/igm; let block, line; while ((block = regex.exec(input))) { From 142e0d85a136854cfe1a1ccac60426c242581d98 Mon Sep 17 00:00:00 2001 From: Thomas <31802793+ThomasNotTom@users.noreply.github.com> Date: Fri, 6 Jun 2025 01:31:49 +0100 Subject: [PATCH 2/2] Correctly handle 2 byte segments ending with a 1 byte segment --- src/core/operations/FromHexdump.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/operations/FromHexdump.mjs b/src/core/operations/FromHexdump.mjs index b8186c76..6fd3c1dc 100644 --- a/src/core/operations/FromHexdump.mjs +++ b/src/core/operations/FromHexdump.mjs @@ -43,7 +43,7 @@ class FromHexdump extends Operation { */ run(input, args) { const output = [], - regex = /^\s*(?:[\dA-F]{4,16}h?:?)?[ \t]+((?:[\dA-F]{2} ){1,8}(?:[ \t]|[\dA-F]{2}-)(?:[\dA-F]{2} ){1,8}|(?:[\dA-F]{4} )*[\dA-F]{2,4}|(?:[\dA-F]{2} )*[\dA-F]{2})/igm; + regex = /^\s*(?:[\dA-F]{4,16}h?:?)?[ \t]+((?:[\dA-F]{2} ){1,8}(?:[ \t]|[\dA-F]{2}-)(?:[\dA-F]{2} ){1,8}|(?:[\dA-F]{4} )+(?:[\dA-F]{2})?|(?:[\dA-F]{2} )*[\dA-F]{2})/igm; let block, line; while ((block = regex.exec(input))) {