![]() |
#1
|
|||
|
|||
![]()
I'm having a problem with a wildcard search/replace.
I'm looking for a specific string that can have an optional few characters in the middle, but Microsoft Word doesn't seem to have an way to include optional characters in the wildcard search (this would be super easy with Regular Expressions, which I understand much better than Word wildcard coding). The string could be either 'BRANDŽ (sub brand text)' or 'BRANDŽ XXL (sub brand text)' So I tried using a single wildcard character ('?'), land imiting it to a range of 1-5 characters using the following: BRANDŽ?{1,5}\(sub brand text\) But, this matches an unlimited number of characters if the sub brand text doesn't exist directly after the first occurrence of BRAND (it matches all of the text between 'BRANDŽ' and the next occurrence of '(sub brand text)' in the entire paragraph) The following does work, but doesn't allow me for the instances where the optional characters don't exist: BRANDŽ?????\(sub brand text\) This is related to the issues I had in a previous thread (https://www.msofficeforums.com/word/...nces-each.html). I need to search for the first instance of either string on each page, so I can't run this as 2 separate searches. I don't understand why my first attempt isn't working, I am specifying that I want 1-5 single character(s). I would expect using '*' instead of '?' to give me this result. I'm assuming I'm doing something wrong with the range to indicate 1-5 occurrences, but I don't see how to fix it. I haven't found anything indicating that you can't use the single character '?' wildcard with the '{n,m}' limits, but this is my only guess as to what is going wrong. Any assistance/explanation would be gratefully appreciated. |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Issue with wildcard search | mysterytramp | Word | 0 | 05-13-2015 10:40 AM |
Where is the error in my wildcard search? | Ulodesk | Word | 10 | 06-30-2014 01:46 PM |
![]() |
NobodysPerfect | Word VBA | 4 | 06-11-2014 11:02 AM |
![]() |
NobodysPerfect | Word | 10 | 03-19-2014 04:29 AM |
Wildcard search help. | Kempston | Word | 0 | 11-13-2009 03:58 AM |