Regular replacement of a specified range of strings

make * substitutions for the specified range of elements.

is there a better regular way to hide numbers?
writes how to handle a string. The demo is as follows:

// 
hideCertificate(number) {
    let a = "12345678";
    let len = a.length;
    let res;
    res = `${a.substr(0, len / 2 / 2)}${new Array(Math.floor(len / 2)).fill("*").join("")}${a.substr(-(len / 2 / 2))}`;
    console.log(res);
    // 12****78
},
Apr.15,2022

res = a.replace (/ ^ (\ d {2}) (. *?) (\ d {2}) $/, (match, p1, p2, p3) = > p1+p2.replace (/. / g, "*") + p3)


replace(/^((\d{2})\d+(\d{2}))$/, '$2****$3')

let len=a.length
let reg=`\\d{${~~(len/4)}}`
a.replace(new RegExp(`^(${reg})(\\d*)(${reg})$`),`$1${"*".repeat(len/2)}$3`)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ea56-2c420.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ea56-2c420.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?