Given a string
\'1.2.3.4.5\'
I would like to get this output
\'1.2345\'
(In case there are no dots in the
let str = "12.1223....1322311.."; let finStr = str.replace(/(\d*.)(.*)/, '$1') + str.replace(/(\d*.)(.*)/, '$2').replace(/\./g,''); console.log(finStr)