Skip to main content
New Participant
March 8, 2023
Answered

Delete space after number in tables

  • March 8, 2023
  • 2 replies
  • 910 views

I need to convert all my numbers from what I think is the french way to American/English.
Ex:
1 023 696 Correct 1,023,696
0,04 correct 0.04

I've found a Grep style converting all space to, that's brilliant, except that all my numbers have a space at the end so I end up with a comma at the end as well...

 

Does anyone know how I can delete space after a number in a table cell?

This topic has been closed for replies.
Correct answer Peter Kahrel

Space-comma replacement:

Find what: \d\K\h(?=\d\d\d)
Change to: ,

 

2 replies

Peter KahrelCorrect answer
Community Expert
March 9, 2023

Space-comma replacement:

Find what: \d\K\h(?=\d\d\d)
Change to: ,

 

Community Expert
March 8, 2023

Find

\h(?=\d{3})

 

This finds any horizontal space - looks ahead for 3 digits

 

Technically

1 00 - won't work

1 000 replaced by 1,000

1 000 000 replace by 1,000,000

and so on

 

The other grep would be

(\d),(\d{2})

$1.$2

 

New Participant
March 8, 2023

Thanks! It almost works like magic! Some numbers like 156 have a space in front and end up ,156. Anyway to get around that?

The other grep works perfectly!

Community Expert
March 9, 2023

GREP looks for patterns - so if the pattern doesn't fit you need another pattern.

 

It might be possible - you'd have to give examples of live text to test fully.