find and replace numbers using wildcards

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top