SOURCE

let str = "${en,num}${format=string}${allowEmptyValue=true}${dataLength=[1,20]}${notAllowaCharacter=¥}${checkedMacType=[mac-nosplit]}"
let arr = str.match(/\$\{(.+?)}/g);
let fromArr = [];
let fromObj = {};

arr.map((item, index) => {
    let str = /\$\{(.+?)}/g.exec(item)[1];
    if (str.indexOf("=") != -1) {
        let strL = str.substring(0, str.indexOf("="));
        let strR = str.substring(str.indexOf("=") + 1, str.length);
        if (strL == "allowEmptyValue") {
            strR = Boolean(strR)
        }
        fromObj[strL] = strR;
    } else {
        fromArr[index] = str.split(',');
    }
})
console.log(fromArr)
console.log(fromObj)
console 命令行工具 X clear

                    
>
console