Search code examples
ms-wordacronym

Special Acronym Finder


I'm compiling an acronyms/abbreviations table for a document. Beyond a simple acronym finder, I would like to find special acronyms that aren't entirely conventional.

Generally I can find acronyms by using <[A-Z]{2,}> in an advanced search. This captures any whole word that is comprised solely of uppercase letters. But I have acronyms that take on other forms too. Beyond an acronym being in the form ABC I have acronyms in this document of other forms.

  1. ABC Generic form, 2 or more uppercase letters

  2. AB&C 1 or more letters preceding and following &

  3. ABC(D) 1 letter in parentheses following 2 or more letters (this only appears twice, so I'm not too worried about it.)

  4. A/C 1 or more letters both preceding and following /

  5. ABC-12 2 or more letters followed by a hyphen and 1 or 2 numbers. This only appears once, so I'm not really worried about it.

In my efforts to create an acronym finder, I've developed this specialized search.

<[A-Z]{1,}[\&\/]*[A-Z]{1,}>

Trying to translate this, I see that this is searching for 1 or more uppercase letters preceding 0 or more of & or / followed by 1 or more uppercase letters. In theory this should find forms 1,2, and 4, but in reality it only finds forms 2 and 4, and not 1. (I'm not as much worried about form 3 as I am form 1, 2, and 4.) I'm stumped at what I need to change. I've tried doing an OR | statement to find one or more form, but Microsoft Word's 'regex' options are different (or appear to be different) from what I generally use.

In summary, my question is what form should my special acronym finder be to find forms 1, 2, and 4 in the table above?


Solution

  • You can use a wildcard Find, where:

    Find = <[A-Z][A-Z0-9&\(\)/-]{1,}

    Beyond that, for identifying acronyms in parentheses and the text to which they refer, see: https://www.msofficeforums.com/word-vba/42313-acronym-definiton-list-generator.html

    See also: https://www.msofficeforums.com/word-vba/19395-acronym-finder-macro-microsoft-word.html