SOURCE

function strReplace(str, startKey, endKey, newKey) {
    let reg = new RegExp('(?<=' + startKey + ').*?(?=' + endKey + ')','g');
    return str.replace(reg, newKey);
}

let str = '\"originY\":\"top\",\"left\":595,\"top\":527.05,\"width\":240,\"height\":33.9,\"fill\":';
//let leftNum = /(?<=left\":).*?(?=,\"top)/;
let a = strReplace(str,'left\":', ',\"top','999');
a = strReplace(a,'top\":', ',\"width','666');
console.log(str, "\n", a);
console 命令行工具 X clear

                    
>
console