Share via

Searching a Word document for abbreviations and their definitions

Anonymous
2021-01-06T16:04:35+00:00

Over the years a number of threads have discussed how to extract a list of the abbreviations used in a Word document.* The basic technique is fairly straightforward: you use Advanced Find with wildcards and search for a pattern like "[A-Z]{2,}" which matches strings of two or more upper case letters. A variant on this is ([A-Z]{2,}) which matches strings of two or more upper case letters surrounded by parentheses. These work pretty well and do give you a list of the abbreviations used.

I wondered whether one could go a step further and try to extract the definitions of the abbreviations as well. This is very difficult in general, but might be possible in the (common) case where the abbreviation is first defined and then given in parentheses. An example: "Responding to these concerns, the International Monetary Fund (IMF) issued a statement that ..."

So the idea would be to match the pattern (IMF) using ([A-Z]{2,}) but also capture the words preceding (IMF). Of course you don't know in general how many words to capture, but in practice most abbreviations are between 2 and 5 characters in length, so capturing the preceding 5 words might be enough to give you most of the definition.

What I can't figure out is how to construct a pattern which is "any five words" followed by "([A-Z]{2,})"

I've looked in Jack Lyon's Wildcard Cookbook for Microsoft Word (a wonderful book, by the way) and tried things like "([A-z]@) ([A-Z,]{2,})" but that just sends Word into what seems like an endless loop and eventually Word stops responding and has to be closed down.

I've run out of ideas of how to word this pattern. Suggestions welcome.

Stephen Yeo

* e.g.

https://answers.microsoft.com/en-us/msoffice/forum/all/is-there-a-way-to-search-your-document-for/7d94ea8d-2be8-488d-be03-f0b5a8043f87

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

4 answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 322.9K Reputation points MVP Volunteer Moderator
    2021-01-06T22:42:29+00:00

    You could use a macro that upon finding "([A-Z]{2,})" would set a range variable to that and then move the start of the range backwards until the range included five words.

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2021-01-07T09:11:39+00:00

    Very interesting. Let me try to get my head around these posts.

    Thanks very much indeed!

    Regards

    Stephen Yeo

    0 comments No comments
  3. Paul Edstein 82,861 Reputation points Volunteer Moderator
    2021-01-07T00:07:14+00:00
    0 comments No comments
  4. Anonymous
    2021-01-06T23:33:56+00:00

    You are right - a macro would do the trick. I was hoping to keep things simple by using just wildcards, but that may not be possible.

    Thanks very much.

    Stephen Yeo

    0 comments No comments