I have a specific string that I need to modify from {Rotation:[45f,90f],lvl:10s}
to {Rotation:[45,90],lvl:10}
.
Here is the code I tried:
const bar = `{Rotation:[45f,90f],lvl:10s}`
const regex = /(\d)\w+/g
console.log(bar.replace(regex, '$&'.substring(0, -1)))
I also attempted to extract the last character using $
but it hasn't been successful so far.