Js regular expression

I want to convert 3011 to 3.0.11, that is, the last two bits synthesize one bit

.
"3011".replace(/(\d{1})/g,"$1.").replace(/\.$/,"")

can be converted to 3.0.1.1

but why can"t you get 3.0.11

in this way?
"3011".replace(/(\d{1})(\d{2})$/g,"$1.$2")

what you get is 30.11. Why can"t you get 3.0.11 in this way? how can you change it if you want to get it?

Jun.16,2022

idea: replace all numbers with number +. But there must be at least two numbers after the number

str.replace(/(\d)(?=\d{2})/g,'$1.')

'3011'.replace(/(\d)(\d)(\d{2})$/g,'$1.$2.$3')
//"3.0.11"
'9873011'.split('').join('.').replace(/\.(?=\d$)/,'')
//"9.8.7.3.0.11"

regularization is not proficient, but it is a stupid way to use.

let str = '123456789'
str.substring(0,str.length-2).replace(/(\d{1})/g,'$1.')+str.substring(str.length-2)
//1.2.3.4.5.6.7.89

var str = '301126562654';
    str.replace(/\d/g, function (i, j) {
        if (j >= str.length - 2) {
            return i
        } else {
            return i + '.'
        }

    })
    
    var str = '301126562654';
    str.replace(/\d/g,  (i, j)=> j>=str.length-2?i:i+'.')
    
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-1b43164-2bde1.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-1b43164-2bde1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?