Replace text question

D

D. Power

Hi:

I have a tab-delimited file that I want to convert to a table in Word.
Before I can do that, I have to change some of the tabs to paragraph
marks What I want to do is to find every tab followed by a digit; I
can do this by searching for a tab and any digit (^t^#), but then I
want to just replace the tab, leaving the digit in place. If I tell it
to replace with a paragraph mark, then it will replace both
characters. I could do the replace by hand, of course, but it's a
rather large file, and I don't like to do anything myself that I can
get a machine to do.

Any suggestions? Thanks
 
J

John McGhie [MVP - Word]

Geez, take it easy! I had to look that one up in the Help!!

OK, you can search for (^t)([0-9])

And replace with \2^p

Or ^p\2

What this does is divide your search term into two independently-evaluated
expressions. In the Replace, you replace expression 2 (the digit) with the
\2 -- the second part of the search term, and the tab with the ^p -- the
first part of the search term.

Use the first replace if you want the digit to precede the paragraph mark
(.e. Put the paragraph mark on the end of the line and have the digit
immediately before it).

Use the second replace if you want the digit to begin the new line after the
paragraph mark.

Now: Don't make me think late at night!! This is documented in the Help
under "Wildcards". In Word X's help, you have to do a bit of digging around
to find it: follow the links from the main topic: I promise you it *is* in
there.

Cheers

from "D. said:
Hi:

I have a tab-delimited file that I want to convert to a table in Word.
Before I can do that, I have to change some of the tabs to paragraph
marks What I want to do is to find every tab followed by a digit; I
can do this by searching for a tab and any digit (^t^#), but then I
want to just replace the tab, leaving the digit in place. If I tell it
to replace with a paragraph mark, then it will replace both
characters. I could do the replace by hand, of course, but it's a
rather large file, and I don't like to do anything myself that I can
get a machine to do.

Any suggestions? Thanks

--

Please respond only to the newsgroup to preserve the thread.

John McGhie, Consultant Technical Writer,
McGhie Information Engineering Pty Ltd
Sydney, Australia. GMT + 10 Hrs
+61 4 1209 1410, mailto:[email protected]
 
D

D. Power

John McGhie said:
Geez, take it easy! I had to look that one up in the Help!!

OK, you can search for (^t)([0-9])

And replace with \2^p

Or ^p\2

What this does is divide your search term into two independently-evaluated
expressions. In the Replace, you replace expression 2 (the digit) with the
\2 -- the second part of the search term, and the tab with the ^p -- the
first part of the search term.

Got it, thanks. Use wildcards had to be turned on in order for it to
work.
Use the first replace if you want the digit to precede the paragraph mark
(.e. Put the paragraph mark on the end of the line and have the digit
immediately before it).

Use the second replace if you want the digit to begin the new line after the
paragraph mark.

Now: Don't make me think late at night!! This is documented in the Help
under "Wildcards". In Word X's help, you have to do a bit of digging around
to find it: follow the links from the main topic: I promise you it *is* in
there.

Cheers

I did find it in the Help files, I guess I didn't dig deep enough
before. Thanks for your help, sorry about the late night thing ;-)
 
K

Klaus Linke

I did find it in the Help files, I guess I didn't dig deep enough
before. Thanks for your help, sorry about the late night thing ;-)

The article http://word.mvps.org/FAQs/General/UsingWildcards.htm has some
help on locating the help page ;-)

Haven't tried on a Mac, though...
Those who are too smart to engage in politics are punished by being governed
by those who are dumber. Plato

I heard that in ancient Greece, "idiot" refered to "somebody not engaged in
politics":
http://www.heir.org/opidiot.htm

Regards,
Klaus
 

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