Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
fjfvan fjfvan is offline
external usenet poster
 
Posts: 2
Default find and replace using wildcard characters

How do I do a search and replace using wildcard characters? I know that I
have to select Use wildcards in the search and replace dialog window. For
instance I want to replace all instances of words enclosed using single
quotes with double quotes. I put the following in the find entry field: '*'.
Word retrieves the words in single quotes, but when I try to replace it with
the following in the replace entry field "*", it replaces the string with
exactly that ("*"). I don't know how to make the replace use the wildcard
characters as well.
  #2   Report Post  
Posted to microsoft.public.word.newusers
Klaus Linke Klaus Linke is offline
external usenet poster
 
Posts: 413
Default find and replace using wildcard characters

"fjfvan" wrote:
How do I do a search and replace using wildcard characters?
I know that I have to select Use wildcards in the search and replace
dialog window. For instance I want to replace all instances of words
enclosed using single quotes with double quotes. I put the following
in the find entry field: '*'.
Word retrieves the words in single quotes, but when I try to replace it
with the following in the replace entry field "*", it replaces the string
with exactly that ("*"). I don't know how to make the replace use the
wildcard characters as well.



You have a couple of things right, but it does not quite fit together yet...

* does match any text, and since you want to match anything between single
quotes, that's a good start.
You can put stuff in (parentheses) so that you can then re-use those
sub-expressions within the (parentheses) in "Replace with", and throw away
stuff that is outside.

So you might use
Find what: '(*)'

What's missing is how to re-use the stuff in the bracket in "Replace
with"...
That is done with \1 ...

So you could use
Replace with: "\1"

For safety, I'd use say
Find what: '(*)'

That introduces the jokers and which only match text at the beginning
and at the end of a word.

The reason: Apostrophes appear all over the place in English, so it makes
sense to lower the changes you match something that is not actually a quote.

For the same reason, I avoid the * wildcard as too risky, and use say
[!^13]@ instead, which matches any text too, but never matches across
paragraphs (... ^13 being the code of the paragraph mark).

For figuring out the above, and for more info, see for example
http://word.mvps.org/faQs/General/UsingWildcards.htm

But above that, experiment whenever you have something that looks like it
might be done better with a wildcard replacement.

Regards,
Klaus

  #3   Report Post  
Posted to microsoft.public.word.newusers
fjfvan fjfvan is offline
external usenet poster
 
Posts: 2
Default find and replace using wildcard characters

Dear Klaus:

Thank you so much! You are a lifesaver. This helped enormously.

FF

"Klaus Linke" wrote:

"fjfvan" wrote:
How do I do a search and replace using wildcard characters?
I know that I have to select Use wildcards in the search and replace
dialog window. For instance I want to replace all instances of words
enclosed using single quotes with double quotes. I put the following
in the find entry field: '*'.
Word retrieves the words in single quotes, but when I try to replace it
with the following in the replace entry field "*", it replaces the string
with exactly that ("*"). I don't know how to make the replace use the
wildcard characters as well.



You have a couple of things right, but it does not quite fit together yet...

* does match any text, and since you want to match anything between single
quotes, that's a good start.
You can put stuff in (parentheses) so that you can then re-use those
sub-expressions within the (parentheses) in "Replace with", and throw away
stuff that is outside.

So you might use
Find what: '(*)'

What's missing is how to re-use the stuff in the bracket in "Replace
with"...
That is done with \1 ...

So you could use
Replace with: "\1"

For safety, I'd use say
Find what: '(*)'

That introduces the jokers and which only match text at the beginning
and at the end of a word.

The reason: Apostrophes appear all over the place in English, so it makes
sense to lower the changes you match something that is not actually a quote.

For the same reason, I avoid the * wildcard as too risky, and use say
[!^13]@ instead, which matches any text too, but never matches across
paragraphs (... ^13 being the code of the paragraph mark).

For figuring out the above, and for more info, see for example
http://word.mvps.org/faQs/General/UsingWildcards.htm

But above that, experiment whenever you have something that looks like it
might be done better with a wildcard replacement.

Regards,
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
Wildcard replacement of characters and style Hans L[_2_] Microsoft Word Help 3 August 1st 07 04:56 PM
Find & Replace Wildcard Expression for Ordinal Numbers binar Microsoft Word Help 1 July 27th 07 04:41 PM
Find multiple characters in one find using MSword find/replace Cliff Microsoft Word Help 2 October 29th 06 07:48 PM
Help with Wildcard search/replace, please? Ed Microsoft Word Help 1 July 14th 06 12:48 AM
Bizarre wildcard replace cfulmer Microsoft Word Help 2 January 29th 06 07:15 AM


All times are GMT +1. The time now is 01:40 PM.

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"