Search and replace hyphens with N dash

M

Michael

I have a long document and have misused the hyphen for the
N-dash to show range of numbers. It should be easy to
globally correct (this is a 400-page document!). I can do
find for ANY DIGIT- but I cannot get it to replace with an
N-dash. I would like to program it to find ANY DIGIT-ANY
DIGIT and replace with ANY DIGIT--ANY DIGIT. I cannot seem
to get the replace to work.
 
K

Klaus Linke

Hi Michael,

Looks like a textbook example for wildcard replacements ;-)
In Edit > Replace, check "Match wildcards".
Find what: ([0-9])-([0-9])
Replace with: \1^=\2

[0-9] matches any number.
\1 puts in the stuff from the first (bracket), that's the number preceeding
the hyphen.
\2 ditto for the (expression) following the hyphen.
^= is the joker for the N-dash; you could also have used the ANSI code
^0150.

Regards,
Klaus
 
J

Jezebel

With 'Use wildcards' checked, search for: ([0-9])-([0-9]) and replace
with: \1^0150\2

You might need to run this twice. Word's regular expression engine is
slightly cludgy, so it will miss the second hyphen if you have a seqence
like N-N-N -- but it will catch it the second time around.
 

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