Re: edit-replace function
From: Graham Mayor (gmayor_at_DELETECAPSmvps.org)
Date: 02/25/04
- Next message: Graham Mayor: "Re: edit-replace function"
- Previous message: Graham Mayor: "Re: Printer selection for labels"
- In reply to: Lewis Shanks: "Re: edit-replace function"
- Next in thread: Suzanne S. Barnhill: "Re: edit-replace function"
- Reply: Suzanne S. Barnhill: "Re: edit-replace function"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 25 Feb 2004 07:36:04 +0200
Jon seems to have the measure of this - but there are two issues why the
search pattern may not be finding the string
1. There are two spaces between the number and fax - not one as shown in the
original search string (and if you paste the string from your message into
Word, one of those spaces is a non-breaking space. You can check in the
original document by viewing the space characters with CTRL+* a space will
be seen as a dot a non breaking space as a small circle. Change the search
pattern to reflect that.
ie
([0-9\-]{12}) ^s(fax:) - where ^s is the non breaking space.
The search really is quite simple and the details of how to use wildcard
searches can be found in the article in the link that Suzanne posted
Here, you have two round bracketed sections. The brackets are there only to
identify the sections. They are not part of the search itself.
The bit in the first set of square brackets [0-9\-] tells Word to look for
any numeral or hyphen. Because hyphen is a reserved character the \ tells
Word to treat it as a character to search. This Word should look for any
numeral or hyphen. The {12} tells Word to look for a sequence of 12 such
characters. That completes the first section. Next are the spaces and
finally the bracketed fax text. We use the brackets because we want to use
the content in the replace string.
The \2 \1 tells Word to replace with the second bracketed bit followed by a
space then the first bracketed bit.
Adjust the strings to reflect *exactly* what you have and want.
If, as I read somewhere, you want to replace fax: with fx: or vice versa,
you don't need the second bracketed bit. You type exactly what you want in
the replacement eg.
([0-9\-]{12}) fx:
fax: \1
--
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Graham Mayor - Word MVP
Web site www.gmayor.com
Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
Lewis Shanks wrote:
> Jon:
> I'm really feeling stupid here!
>
> The wildcards check box was/is checked per what the "Finding and
> Replacing characters using wildcards" site suggests.
> In the same para which says to check this box, it further says "in a
> macro, set.Find.MatchWildcards = True." If you do not do this, Word
> treats the wildcard characters as if they were ordinary text." I have
> no idea how to do this! I went to Macros and got lost immediately.
>
> Same as before, after making sure that the find box details are
> correctly typed and the replace with box has \2 \1 in it, I again try
> to replace all and end up with no results.
>
> Is there any way that I might be able to call you to discuss further?
>
> Lewis
>
> "Jon Weaver" <anonymous@discussions.microsoft.com> wrote in message
> news:Ob1PY4v%23DHA.4012@tk2msftngp13.phx.gbl...
>> It works exactly as Graham Mayor wrote for the specific pattern you
>> requested.
>>
>> In the Find what box, make sure there is a space before "(fax:)" and
>> that there are no other spaces in the box; also make sure you have
>> used the correct form of bracket -- square [], curly {} and rounded
>> or parentheses ()
>>
>> Also make sure you have clicked More and checked the Use wildcards
>> check box; if this check box is not checked, Word will find and
>> replace nothing
>>
>> Good luck!
>>
>> Jon
- Next message: Graham Mayor: "Re: edit-replace function"
- Previous message: Graham Mayor: "Re: Printer selection for labels"
- In reply to: Lewis Shanks: "Re: edit-replace function"
- Next in thread: Suzanne S. Barnhill: "Re: edit-replace function"
- Reply: Suzanne S. Barnhill: "Re: edit-replace function"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|