Made RegEx matching more general

This commit is contained in:
Sebski123
2021-03-29 16:44:54 +02:00
committed by GitHub
parent 7ca5c96f4a
commit f895229c70
+3 -3
View File
@@ -821,8 +821,8 @@
var input = document.getElementById("byte-input").value;
// Remove Arduino code
input = input.replace(/const unsigned char myBitmap \[\] PROGMEM = \{/g, "");
input = input.replace(/\};/g, "");
input = input.replace(/(const)?\s+(unsigned\s+char|uint8_t)\s+[a-zA-Z0-9]+\s*\[\]\s*(PROGMEM\s*)?=\s*/g, "");
input = input.replace(/\};|\{/g, "");
// Convert newlines to comma (helps to remove comments later)
input = input.replace(/\r\n|\r|\n/g, ",");
@@ -833,7 +833,7 @@
//Remove comments
input = input.replace(/\/\/(.+?),/g, "");
// Remove "0x"
input = input.replace(/0x/g, "");
input = input.replace(/0[xX]/g, "");
// Split into list
var list = input.split(",");
console.log(list);