user9183879
user9183879

Reputation:

How to replace a whitespace between a group of numbers with a dot or a comma?

I have this group of numbers: 1 000 , 30 000 , 400 000 on some text files and it's a lot of them. I want to search all of this group numbers and add between them a dot or comma , like this 1,000 or this 1.000.

I know I can find them like this : \d \d\d\d, but I don't know what do next to replace that white space with a comma or a dot.

Upvotes: 2

Views: 46

Answers (1)

Toto
Toto

Reputation: 91385

If you regex flavour supports lookaround, you can do:

  • Find: (?<=\d)\s+(?=\d)
  • Replace: , or .

if it doesn't:

  • Find: (\d)\s+(\d)
  • Replace: $1,$2 or $1.$2

Both will replace a space between 2 digits with a comma or a dot

Upvotes: 1

Related Questions