Search code examples
ms-wordwildcard

Word Wildcard search being dumb


So I have a program that is trying to find and run macros based on if the document contains macro:MacroName. I want the "macro" bit to be case insensitive (incase some numpty decides MaCrO is perfectly acceptable). Problem is that I can make 4 out of 5 of the letters case insensitive but if I make all 5 case insensitive, Word complains it's too complicated. Are there any work arounds?

This is my current search term: "[<][Mm][Aa][Cc][Rr]o:[!>]{1,20}[>]"

I tried changing up which letters are case insensitive and not and it's always a cap of 4 letters. The [!>]{1, 20} bit is to cap the length of the name to 20 characters since macros can't have a name longer than 20 letters.


Solution

  • Try:

    \<[Mm][Aa][Cc][Rr][Oo]:[!\>]@\>