Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Ben Bullock Ben Bullock is offline
external usenet poster
 
Posts: 2
Default Wildcard search for *:

I'm trying to do a wildcard search for a single word followed by a colon at
the beginning of a line.

Based on the following article, I thought the correct syntax for this would
be "*:".

http://office.microsoft.com/en-us/he...873051033.aspx

When I try to search for *: with wildcards switched on, I get a result
that I didn't expect, so that in something like

text text text
name: text text

the highlighting is from * to * as in the following:

*text text text
name:* text text

If I then search for the next one, I get

text *text text
name:* text text

and so on, until only the name is highlighted.

Searching for * seems to work but the colon after the seems to mess
things up. *: doesn't match anything, and putting a \ before the colon
*\: doesn't work either.

You can see a screenshot he

http://flickr.com/photos/bnz/1661669990/

[The Word version I have is in Japanese but I don't think this is a Japanese
Word-specific issue.]

What should I be doing?

  #2   Report Post  
Posted to microsoft.public.word.newusers
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Wildcard search for *:

Tp quote Graham Mayor
(http://www.gmayor.com/replace_using_wildcards.htm), "The asterisk is
a rather blunt weapon which must be used with care, as it can return a
lot of unwanted results."

The source of the problem is that the asterisk as a wildcard will
match as many characters as possible (sometimes called "greedy
matching"). In your experiments, it does indeed match the start of a
word at its beginning, and the end of a word at its end, but there's
nothing to force them to be in the _same_ word.

If you want a single word (with no spaces, punctuation, or digits)
followed by a colon, try searching for

[A-Za-z]{1,}:


On Sun, 21 Oct 2007 09:22:32 +0900, "Ben Bullock"
wrote:

I'm trying to do a wildcard search for a single word followed by a colon at
the beginning of a line.

Based on the following article, I thought the correct syntax for this would
be "*:".

http://office.microsoft.com/en-us/he...873051033.aspx

When I try to search for *: with wildcards switched on, I get a result
that I didn't expect, so that in something like

text text text
name: text text

the highlighting is from * to * as in the following:

*text text text
name:* text text

If I then search for the next one, I get

text *text text
name:* text text

and so on, until only the name is highlighted.

Searching for * seems to work but the colon after the seems to mess
things up. *: doesn't match anything, and putting a \ before the colon
*\: doesn't work either.

You can see a screenshot he

http://flickr.com/photos/bnz/1661669990/

[The Word version I have is in Japanese but I don't think this is a Japanese
Word-specific issue.]

What should I be doing?


--
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.
  #3   Report Post  
Posted to microsoft.public.word.newusers
Herb Tyson [MVP] Herb Tyson [MVP] is offline
external usenet poster
 
Posts: 2,936
Default Wildcard search for *:

One additional thing you can do is to add ^13 at the beginning. ^13 is the
paragraph mark before the word, thus guaranteeing that you'll get just words
at the beginning of paragraphs. Or, if some line use the manual line break,
then use [^13^11] to match either kind of break. Done this way:

[^13^11]*:

now matches the first word at the beginning of a line/paragraph, followed by
a colon.

If you need to separate the line/paragraph break from the matched word
and/or colon, you can gain additional control by using:

([^13^11])(*)(

The line/paragraph break, word, and colon, can then be inserted into the
Replace with: text using:

\1 through \3.


--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com
"Jay Freedman" wrote in message
...
Tp quote Graham Mayor
(http://www.gmayor.com/replace_using_wildcards.htm), "The asterisk is
a rather blunt weapon which must be used with care, as it can return a
lot of unwanted results."

The source of the problem is that the asterisk as a wildcard will
match as many characters as possible (sometimes called "greedy
matching"). In your experiments, it does indeed match the start of a
word at its beginning, and the end of a word at its end, but there's
nothing to force them to be in the _same_ word.

If you want a single word (with no spaces, punctuation, or digits)
followed by a colon, try searching for

[A-Za-z]{1,}:


On Sun, 21 Oct 2007 09:22:32 +0900, "Ben Bullock"
wrote:

I'm trying to do a wildcard search for a single word followed by a colon
at
the beginning of a line.

Based on the following article, I thought the correct syntax for this
would
be "*:".

http://office.microsoft.com/en-us/he...873051033.aspx

When I try to search for *: with wildcards switched on, I get a result
that I didn't expect, so that in something like

text text text
name: text text

the highlighting is from * to * as in the following:

*text text text
name:* text text

If I then search for the next one, I get

text *text text
name:* text text

and so on, until only the name is highlighted.

Searching for * seems to work but the colon after the seems to mess
things up. *: doesn't match anything, and putting a \ before the colon
*\: doesn't work either.

You can see a screenshot he

http://flickr.com/photos/bnz/1661669990/

[The Word version I have is in Japanese but I don't think this is a
Japanese
Word-specific issue.]

What should I be doing?


--
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.


  #4   Report Post  
Posted to microsoft.public.word.newusers
Ben Bullock Ben Bullock is offline
external usenet poster
 
Posts: 2
Default Wildcard search for *:

Thanks to Herb Tyson and Jay Freedman for their answers. They were both very
useful.

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 search... buggy? avcarrie Microsoft Word Help 9 November 11th 06 06:18 AM
Wildcard search help. please? Ed Microsoft Word Help 2 September 11th 06 08:50 PM
Help with wildcard search, please? Ed New Users 8 July 28th 06 11:18 AM
Help with Wildcard search/replace, please? Ed Microsoft Word Help 1 July 14th 06 12:48 AM
File Search using the asterisk (*) wildcard Kokomojo Microsoft Word Help 1 January 25th 06 05:08 AM


All times are GMT +1. The time now is 08:52 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"