I’m working in local with Javascript & Php, and I need to replace an object inside a json file, or at least get this object from my JS script.
I tried to use a regex but it doesn’t work.
function getParamsFromFile() {
fetch('./files/storage_game3_forSTACK.json', { cache: "no-store" })
.then(response => {
response.text()
.then( data => {
console.log(data);
const regExp = new RegExp("^/{.*?"6482515245115".*}/$")
if (regExp.test(data)) {
console.log('MATCHES : YES');
}
else {
console.log('MATCHES : NO');
}
})
})
}
Can you help me ?
Thx