Replace dot with comma in float numbers in text

Viewed 37

How can I replace float with dot

const inputText = 'Text 20.43,4 other 6.90 text 12.334 text. Another text 50.60 text 100,9.'

to float with comma, pure javascript?

const outPutText = 'Text 20,43,4 other text 12,334 text. Another text 50,60 text 100,9.'
1 Answers
const x = inputText.replaceAll(/(?<=[0-9])(\.)(?=[0-9])/g, ',')

This replaces all . within numbers to a comma.

Related