Skip to content Skip to sidebar Skip to footer

Removing Spaces Between Numbers Separated By Comma

I would like to remove any space between numbers separated by '.' or ',' for example: 10 , 45, 3 should be: 10,45,3 and 10 . 45 . 3 should be: 10.45.3 Any help to do that in regul

Solution 1:

Using /(\d)\s*([,.])\s*(\d)/g, "$1$2$3" you should be able to do that

var str = "Operations and maintenance $258 .277 billion , Military Personnel $153 .531 billion ,Procurement $97, 757 billion. Research, Development, Testing & Evaluation $63 . 347 billion, Military Construction $8 , 069 billion Family Housing $1. 483 billion.";
str = str.replace(/(\d)\s*([,.])\s*(\d)/g, "$1$2$3");
console.log(str)

Post a Comment for "Removing Spaces Between Numbers Separated By Comma"