G
Guest
Our company documentation refers to Form 1234. It should have been Form
1234-5, but that has not been consistent. I would like to use Find and
Replace to fix it, but I cannot get Replace to work. This is what I have
tried (with several variations)using wildcards:
Find (1234)([!\-])
Replace with \1^~5\2
I have also tried Find (<1234>)([!\-]), and have left out the parentheses
around 1234 (Replace with 1234^~5\1 in that case), and every other variant I
can think of, but no luck. The idea is that I am looking for "1234" followed
by something other than a hyphen, and replacing it with "1234-5" (with a
nonbreaking hyphen) followed by whatever followed originally. I specify
something other than a hyphen because in a few cases it is written correctly
as "1234-5". I used \- because it seemed to be necessary if it was to find
the literal hyphen character. If the text is "(Form 1234)" it is supposed to
replace it with "(Form 1234-5)". Note that the parentheses are part of what
I have found in my document, but the quotes are for purposes of this question
only. What it does instead is find "(Form 1234)", but then replace it with
"(Form 1234)-5". It does the same with a space after "1234", and I end up
with "1234 -5". Can this be made to work, or is the hyphen or some other
special character going to mess this up?
1234-5, but that has not been consistent. I would like to use Find and
Replace to fix it, but I cannot get Replace to work. This is what I have
tried (with several variations)using wildcards:
Find (1234)([!\-])
Replace with \1^~5\2
I have also tried Find (<1234>)([!\-]), and have left out the parentheses
around 1234 (Replace with 1234^~5\1 in that case), and every other variant I
can think of, but no luck. The idea is that I am looking for "1234" followed
by something other than a hyphen, and replacing it with "1234-5" (with a
nonbreaking hyphen) followed by whatever followed originally. I specify
something other than a hyphen because in a few cases it is written correctly
as "1234-5". I used \- because it seemed to be necessary if it was to find
the literal hyphen character. If the text is "(Form 1234)" it is supposed to
replace it with "(Form 1234-5)". Note that the parentheses are part of what
I have found in my document, but the quotes are for purposes of this question
only. What it does instead is find "(Form 1234)", but then replace it with
"(Form 1234)-5". It does the same with a space after "1234", and I end up
with "1234 -5". Can this be made to work, or is the hyphen or some other
special character going to mess this up?