Re: finding specific sequence of wildcard characters
- From: "Jay Freedman" <jay.freedman@xxxxxxxxxxx>
- Date: Thu, 8 May 2008 16:33:00 -0400
bdr122 wrote:
I'm using Word 2007 on Vista Business. In a word document, I'd like
to find single instances of the "*" character (i.e., the asterisk
character). The document contains several single "*" characters as
well as double "**" and triple "***" sequences (each of these
asterisk sequences is also followed by a different sequence of
numbers). But I only want to find the singles, not the doubles or
triples. I've tried the following three searches with wildcards on:
\*{1}
[\*]{1}
(\*){1}
In each case, word finds every "*" character, including those
contained in doubles or triples. Does anyone know of a way to just
find instances of the single "*" character?
Put yourself in the place of the little man inside the computer who has to
carry out your instructions. Scanning through the document, he sees an
asterisk character and highlights it. Then he moves one character to the
right, and there's another asterisk, so he highlights that one -- you
haven't told him not to. One more character to the right, "Oh, look, there's
another one!" And so it goes.
To limit the matches to single asterisks, you have to be very literal and
give the instruction "find one asterisk where the character to its left is
not an asterisk, and the character to its right is not an asterisk". In
wildcard syntax,
[!\*][\*][!\*]
Of course, this is going to highlight all three characters. If you're doing
only a find, there's not much harm in that. If you're doing a replacement,
though, and you want to do something with the asterisk, you need to modify
the search expression to put parentheses around each bracketed term
([!\*])([\*])([!\*])
and use a replace expression like
\1something\3
so the preceding and following characters don't change. Or you may need to
program a macro to do only a find, and then do some more complicated
processing of the matched characters -- for example, if you want to change
the formatting of the asterisk but not of the surrounding characters.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
.
- Follow-Ups:
- Re: finding specific sequence of wildcard characters
- From: Klaus Linke
- Re: finding specific sequence of wildcard characters
- References:
- finding specific sequence of wildcard characters
- From: bdr122
- finding specific sequence of wildcard characters
- Prev by Date: Re: I held down my shift key, filter keys came on. How do I stop it?
- Next by Date: Re: I held down my shift key, filter keys came on. How do I stop it?
- Previous by thread: finding specific sequence of wildcard characters
- Next by thread: Re: finding specific sequence of wildcard characters
- Index(es):
Relevant Pages
|