I leave the refactoring of regex on you, but this is something you can do using String.prototype.match.
function checkStr(str) {
let match = str.match(/(\d)\?{3}(\d)/);
return match && +match[1] + +match[2] === 10;
}
let out = checkStr('bdhfr6???3hfyrt5???eee5');
console.log(out)
out = checkStr('bdhfr6???4hfyrt5???eee5');
console.log(out)
solved consider a string which has question marks, numbers , letters [closed]