find and replace numbers using wildcards

G

Guest

hello

i have a two-column table that has text in one column like "Candy - Apples",
then numbers in the second column in the format "28-159a".

What I want to do is do a find and replace such that all the numbers and
dashes in the second column get deleted, leaving behind only the number after
the dash. I can't do a generic wildcard search for *- because it would also
delete the text and - in the first column.

Any ideas? Thank you.
Andrew
 
J

Jay Freedman

For a wildcard search, the expression [0-9] will match any single
digit, and the expression [0-9]{1,} will match any sequence of
consecutive digits. So you could search for

[0-9]{1,}-

and leave the Replace With box empty.

For completeness, I'll mention that you could use the *- search term
if you select the second column (hover the mouse above the top of the
column so it becomes a downward arrow, then click). After the
replacement, Word will ask whether to search the rest of the document,
and you answer No. But it's safer to use the more specific search
term.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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