Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
[email protected] verticalfont@mailinator.com is offline
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Ed Ed is offline
external usenet poster
 
Posts: 122
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with wildcard search, please? Ed New Users 8 July 28th 06 11:18 AM
File Search using the asterisk (*) wildcard Kokomojo Microsoft Word Help 1 January 25th 06 05:08 AM
File Search Preview Pane ndolinger Microsoft Word Help 0 August 10th 05 09:34 PM
File Search Preview Pane ndolinger Microsoft Word Help 2 August 10th 05 04:12 PM
Problem with search feature in word 2002 Ellen Microsoft Word Help 0 February 8th 05 09:31 PM


All times are GMT +1. The time now is 08:45 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"