is it possible to write same function without using new RegExp as it is give ReDos vulnerability
function extractNum(dataList) {
let resp = []
dataList.forEach((i) => {
let regex = new RegExp(`ab:${name}:${place}(::(.[0-9]*))?`)
let dlist = {
version: i.filter(j => j.match(regex)).map(j => {
let verNo = j.replace(new RegExp(`ab::${name}:ds:${place}(::)?`), '');
return { versionNo: verNo }
})
}
if (dlist.version.length) {
resp.push(dlsit)
}
})
return resp
}