![]() |
|
#1
|
|||
|
|||
![]()
Hi there. In my text, I would like to remove the space for every 4 digits numbers (ex. 2 000 becomes 2000). However, I also have numbers of 1 000 000 or more in this text which thousands are separated by spaces. And by removing the spaces for every 4 digits numbers, I don't want it to affect the numbers of 1 000 000 or more (i.e. I don't want the number "1 000 000" to become "1000 000" because of this change).
I'm looking for a way to do a find/replace (using wildcards) so that 4 digit numbers don't contain a space, but for numbers 1 000 000 and above, the space remains present. Any suggestion? Thanks. Last edited by lalywizz; 10-06-2021 at 06:28 AM. |
#2
|
|||
|
|||
![]()
Ok, nevermind, I found the solution myself.
For those interested, once I remove space for all 4 digit numbers, the numbers of 1 000 000 or more look like this: 1000 000. Then I did a Find/replace using wildcards. I did enter: ([0-9]{1})([0-9]{3}) ([0-9]{3}) Note there is a space before the last sequence. In the Replace with: I did enter \1 \2 \3 So 1000 000 becomes 1 000 000. Exactly what I was looking for. Cheers. |
#3
|
||||
|
||||
![]()
A single wildcard Find/Replace would suffice:
Find = ([!0-9]?[0-9]@) ([0-9]{3}?[!0-9]) Replace = \1\2
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
![]() Quote:
This one doesn't work... I got 0 result. |
#5
|
||||
|
||||
![]()
Works for me. With text like:
Quote:
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]()
You're right! It's working! I probably included a space when I did copy/paste the first time.
Good work! Thanks! |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find and Replace and add colon and space | falcios | Word | 2 | 07-28-2021 04:38 AM |
![]() |
Johanna | Word | 33 | 03-07-2020 01:43 PM |
Macro for Find/replace to remove space before Hard Return | AlfredStreich | Word VBA | 4 | 01-23-2020 03:59 PM |
![]() |
cheech1981 | Word | 3 | 03-29-2017 02:33 PM |
![]() |
Cobb78 | Word | 1 | 05-26-2012 06:16 PM |