Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
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
Posted to microsoft.public.word.newusers
|
|||
|
|||
Wildcard search for *:
Thanks to Herb Tyson and Jay Freedman for their answers. They were both very
useful. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Wildcard search... buggy? | Microsoft Word Help | |||
Wildcard search help. please? | Microsoft Word Help | |||
Help with wildcard search, please? | New Users | |||
Help with Wildcard search/replace, please? | Microsoft Word Help | |||
File Search using the asterisk (*) wildcard | Microsoft Word Help |