1

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.

macropod
  • 12,757
  • 2
  • 9
  • 21

1 Answers1

1

Try:

\<[Mm][Aa][Cc][Rr][Oo]:[!\>]@\>
macropod
  • 12,757
  • 2
  • 9
  • 21
  • Sadly this picks up tags that should be incorrect. If the document contains "", it'll select the entire thing before selecting the correct one on the right. – CephDigital Mar 28 '22 at 10:19
  • Ah, I made a slight adjustment and it works fine now :D \<[Mm][Aa][Cc][Rr][Oo]:[!><]{1,20}@\> – CephDigital Mar 28 '22 at 10:20