Search and Replace

J

Johann Swart

I have many tables with hundreds of entries with the following pattern:
1ABC234DE. I need to place spaces between 1 and A, between C and 2, and
between 4 and D, in other words, the entry should be
1[space]ABC[space]234[space]DE. I intend to do a separate run for each of the
3 spaces.
For the first run, in Find and Replace, in the Find What line, I enter
(quotes not included) "([0-9])([A-Z])", and in the Replace With line, I enter
"\1[space]\2" with Use Wildcards selected. The result I get is 1A[space]BC...
..
What am I doing wrong, and is there a method of doing only one run to insert
all 3 spaces?
PS: If I should rather post this query in the Word Programming section,
please advise.
 
G

garfield-n-odie [MVP]

Much easier to do in Excel... just copy and paste to Excel, use a
concatenate formula to add the spaces, convert formulas to
values, and then copy and paste back into Word.
 
T

Tony Jollans

There is a bug in F&R when replacing with found strings and literals when
Track Changes is turned on, which appears to be what you are hitting here.

With Track Changes turned off, this should work ...

Find ([0-9])([A-Z]{3})([0-9]{3})([A-Z])
Replace \1[space]\2[space]\3[space]\4
Use wildcards
Replace All
 
J

Johann Swart

Hi Tony/Graham/Garfield

Yes, I neglegted to mention that this happens with 'Track Changes' turned ON.
Thanks for all the input and the solution. Much appreciated.

Johann Swart

Tony Jollans said:
There is a bug in F&R when replacing with found strings and literals when
Track Changes is turned on, which appears to be what you are hitting here.

With Track Changes turned off, this should work ...

Find ([0-9])([A-Z]{3})([0-9]{3})([A-Z])
Replace \1[space]\2[space]\3[space]\4
Use wildcards
Replace All

--
Enjoy,
Tony

Johann Swart said:
I have many tables with hundreds of entries with the following pattern:
1ABC234DE. I need to place spaces between 1 and A, between C and 2, and
between 4 and D, in other words, the entry should be
1[space]ABC[space]234[space]DE. I intend to do a separate run for each of the
3 spaces.
For the first run, in Find and Replace, in the Find What line, I enter
(quotes not included) "([0-9])([A-Z])", and in the Replace With line, I enter
"\1[space]\2" with Use Wildcards selected. The result I get is 1A[space]BC...
.
What am I doing wrong, and is there a method of doing only one run to insert
all 3 spaces?
PS: If I should rather post this query in the Word Programming section,
please advise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top