Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
Using Ctrl+H, with "Use Wildcards" checked, I am searching for
(^t^t^t)(i.)([ ]{1,2}) I want to replace with (^t^t)([^40]1[^41])([ ]) (The last time I tried a wildcard search, I had trouble with [\(] and [\)], and I substituted ^40 and ^41 and it worked fine.) The Find part works great. The Replace, though, is actually inserting the "(^t^t)([^40]1[^41])([ ])", rather than two tabs, (1), and two spaces!! Why?? -- Ed Chief Chef, Kludge Code Cafe "Spaghetti Is Our Specialty!" ' |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
You don't need any of the parens. You can get rid of them in the find
and the replace. They are for replacing variable found targets, which you are not doing. You can use regular parens in the replace and you do not need brackets there. Just to fix your immediate problem ^t^t^ti. {1,2} as the find what and ^t^t(1) as the replace with will work fine. Ed wrote: Using Ctrl+H, with "Use Wildcards" checked, I am searching for (^t^t^t)(i.)([ ]{1,2}) I want to replace with (^t^t)([^40]1[^41])([ ]) (The last time I tried a wildcard search, I had trouble with [\(] and [\)], and I substituted ^40 and ^41 and it worked fine.) The Find part works great. The Replace, though, is actually inserting the "(^t^t)([^40]1[^41])([ ])", rather than two tabs, (1), and two spaces!! Why?? -- Ed Chief Chef, Kludge Code Cafe "Spaghetti Is Our Specialty!" ' |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
Thanks. It does work. But a question: then does "Use Wildcards" only
apply to the Find text? Why isn't it throwing an error on the parentheses in the Replace With text? I would have thought they would need to be escaped or replaced with character equivalents. Ed wrote in message oups.com... You don't need any of the parens. You can get rid of them in the find and the replace. They are for replacing variable found targets, which you are not doing. You can use regular parens in the replace and you do not need brackets there. Just to fix your immediate problem ^t^t^ti. {1,2} as the find what and ^t^t(1) as the replace with will work fine. Ed wrote: Using Ctrl+H, with "Use Wildcards" checked, I am searching for (^t^t^t)(i.)([ ]{1,2}) I want to replace with (^t^t)([^40]1[^41])([ ]) (The last time I tried a wildcard search, I had trouble with [\(] and [\)], and I substituted ^40 and ^41 and it worked fine.) The Find part works great. The Replace, though, is actually inserting the "(^t^t)([^40]1[^41])([ ])", rather than two tabs, (1), and two spaces!! Why?? -- Ed Chief Chef, Kludge Code Cafe "Spaghetti Is Our Specialty!" ' |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
"Ed" wrote:
Thanks. It does work. But a question: then does "Use Wildcards" only apply to the Find text? Why isn't it throwing an error on the parentheses in the Replace With text? I would have thought they would need to be escaped or replaced with character equivalents. Hi Ed, Apart from the backslash \ and the caret ^, there aren't any characters with special meaning in "Replace with", so there is no need for braces (or any of the other "Find what" wildcards) to be escaped. The only wildcards in "Replace with" are \1, \2, ..., and the jokers like ^&, ^c, ... Say in your replacement, you could have re-inserted the leading two tabs: Find what: (^t^t)^ti.[ ]{1,2} Replace with: \1(1)^32 \1 here re-inserts the content of the (first) brace (^t^t). You could have typed a space instead of ^32 ... I just used ^32 so it because a space would have been invisible in this post, and to demonstrate a use of the ^caret in "Replace with". Regards, Klaus |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
Thank you, Klaus. So the answer to:
But a question: then does "Use Wildcards" only apply to the Find text? is apparently Yes? I'll have to remember this - it will make things much easier. Just to check - this is also true in VBA using the Find object? Originally this was going to be part of a macro with a number variable that would increment as it looped (but I couldn't find a way to get the number into a small Roman numeral format - I have a post in the VBA NG asking about this now). Ed "Klaus Linke" wrote in message ... "Ed" wrote: Thanks. It does work. But a question: then does "Use Wildcards" only apply to the Find text? Why isn't it throwing an error on the parentheses in the Replace With text? I would have thought they would need to be escaped or replaced with character equivalents. Hi Ed, Apart from the backslash \ and the caret ^, there aren't any characters with special meaning in "Replace with", so there is no need for braces (or any of the other "Find what" wildcards) to be escaped. The only wildcards in "Replace with" are \1, \2, ..., and the jokers like ^&, ^c, ... Say in your replacement, you could have re-inserted the leading two tabs: Find what: (^t^t)^ti.[ ]{1,2} Replace with: \1(1)^32 \1 here re-inserts the content of the (first) brace (^t^t). You could have typed a space instead of ^32 ... I just used ^32 so it because a space would have been invisible in this post, and to demonstrate a use of the ^caret in "Replace with". Regards, Klaus |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
Yes in principle. Only, in the VBA editor you can't use Unicode characters
(code 255), and have to "escape" quote marks with another quote mark, or use ChrW(34). Klaus "Ed" schrieb im Newsbeitrag ... Thank you, Klaus. So the answer to: But a question: then does "Use Wildcards" only apply to the Find text? is apparently Yes? I'll have to remember this - it will make things much easier. Just to check - this is also true in VBA using the Find object? Originally this was going to be part of a macro with a number variable that would increment as it looped (but I couldn't find a way to get the number into a small Roman numeral format - I have a post in the VBA NG asking about this now). Ed "Klaus Linke" wrote in message ... "Ed" wrote: Thanks. It does work. But a question: then does "Use Wildcards" only apply to the Find text? Why isn't it throwing an error on the parentheses in the Replace With text? I would have thought they would need to be escaped or replaced with character equivalents. Hi Ed, Apart from the backslash \ and the caret ^, there aren't any characters with special meaning in "Replace with", so there is no need for braces (or any of the other "Find what" wildcards) to be escaped. The only wildcards in "Replace with" are \1, \2, ..., and the jokers like ^&, ^c, ... Say in your replacement, you could have re-inserted the leading two tabs: Find what: (^t^t)^ti.[ ]{1,2} Replace with: \1(1)^32 \1 here re-inserts the content of the (first) brace (^t^t). You could have typed a space instead of ^32 ... I just used ^32 so it because a space would have been invisible in this post, and to demonstrate a use of the ^caret in "Replace with". Regards, Klaus |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
Thanks for all your help, Klaus. I appreciate it.
Ed "Klaus Linke" wrote in message ... Yes in principle. Only, in the VBA editor you can't use Unicode characters (code 255), and have to "escape" quote marks with another quote mark, or use ChrW(34). Klaus "Ed" schrieb im Newsbeitrag ... Thank you, Klaus. So the answer to: But a question: then does "Use Wildcards" only apply to the Find text? is apparently Yes? I'll have to remember this - it will make things much easier. Just to check - this is also true in VBA using the Find object? Originally this was going to be part of a macro with a number variable that would increment as it looped (but I couldn't find a way to get the number into a small Roman numeral format - I have a post in the VBA NG asking about this now). Ed "Klaus Linke" wrote in message ... "Ed" wrote: Thanks. It does work. But a question: then does "Use Wildcards" only apply to the Find text? Why isn't it throwing an error on the parentheses in the Replace With text? I would have thought they would need to be escaped or replaced with character equivalents. Hi Ed, Apart from the backslash \ and the caret ^, there aren't any characters with special meaning in "Replace with", so there is no need for braces (or any of the other "Find what" wildcards) to be escaped. The only wildcards in "Replace with" are \1, \2, ..., and the jokers like ^&, ^c, ... Say in your replacement, you could have re-inserted the leading two tabs: Find what: (^t^t)^ti.[ ]{1,2} Replace with: \1(1)^32 \1 here re-inserts the content of the (first) brace (^t^t). You could have typed a space instead of ^32 ... I just used ^32 so it because a space would have been invisible in this post, and to demonstrate a use of the ^caret in "Replace with". Regards, Klaus |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Wildcard search finds okay, but replaces wrong??
The easiest way to create the Find code is usually with the macro recorder.
Klaus |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with wildcard search, please? | New Users | |||
File Search using the asterisk (*) wildcard | Microsoft Word Help | |||
File Search Preview Pane | Microsoft Word Help | |||
File Search Preview Pane | Microsoft Word Help | |||
Problem with search feature in word 2002 | Microsoft Word Help |