Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Space after every nth character 4

Status
Not open for further replies.

JackGat

Technical User
Dec 28, 2009
15
US
Hi

I need to place either a space, line break or a paragraph marker after every 7th character. How can I accomplish this in WORD? Thanks Cheers

Current Format
1 0000515
2 0000021
3 0000021000002500002670000298
4 0000009000026700002960000574
5 000002500000260000032
6 000002100000250000267
7 00000020000021000002500000260000032000028300002850000298


Desired Results

1 0000515
2 0000021
3 0000021 0000025 0000267 0000298
4 0000009 0000267 0000296 0000574
5 0000025 0000026 0000032
6 0000021 0000025 0000267
7 0000002 0000021 0000025 0000026 0000032 0000283 0000285 0000298
 
In the find and replace dialog box, check 'use wildcards' and use:

Find what: "([0-9]{7})"
Replace with: "\1 "

(note the space in the 'replace with' line)
 
I can't seem to get this to work....I know it's not my thread but I can see other application for this idea. when I try this in my Word doc (2003) it doesn't work. Actually, it does nothing. I have cut and pasted the data and the find and replace info. When I hit replace all it says 0 finds. Any ideas why it's not working?. thanks.

Be Alert, America needs more lerts
 
In the find and replace dialog, don't use the double quotes. I used them just to show the space character in the replace line. Also, be sure you have the 'use wildcards' option checked. You may need to expand the dialog box to see it.
 
thanks jges...that worked, but I know I tried it without the quotes...and with the "use wildcards"...maybe I didn't hold my mouse correctly...anyway, thanks again....

Be Alert, America needs more lerts
 
Thanks, I'm glad you found it helpful.
I've recently been learning about regular expressions and only recently found out that Word allows use of its own flavor. I must give credit to forum member TonyJollans for pointing that out (thread68-1619591).

For those interested in learning more about regular expressions, I have found this site very helpful as a reference: Also, I've been using the book Mastering Regular Expressions by Jeffrey Friedl ( The book goes pretty deep (I haven't finished it yet) but its good to know what's going on behind the scenes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top