Written by Allen Wyatt (last updated October 2, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and 2021
Leonardo has a document that contains a good number of camel-case words, which contain both upper- and lower-case letters (YouTube, WhatsApp, etc.). He wonders if there is a way to easily find such camel-case words in the document.
Yes, this can be done, but it is best to first figure out what, exactly, is meant by "camel case." We already know that Leonardo considers words like YouTube and WhatsApp to be camel case. These begin with an uppercase letter and then have a single capital letter in the remainder of the word, ending in a lowercase letter. What about words like iPhone or eMail, where the entire word is lowercase except for a single uppercase letter within the word? What about acronyms (which Word treats as words) such as UoT or PhD?
The mixture of uppercase and lowercase within a word is important to note. Each variation can be described as a pattern of letters, and because we can do that, then we can use a wildcard search to look for the pattern. For instance, let's say that you want to define camel-case words as those that begin with an uppercase letter and have another single uppercase letter elsewhere in the word, as in Leonardo's original examples of YouTube and WhatsApp. You could follow these steps to find such words:
The key to success with this approach is to correctly define the pattern used in step 5. In the pattern shown above, the characters "<[A-Z]" means "find a word that begins with exactly one uppercase letter." The following characters ("[a-z]@") means "followed by at least one lowercase letter." The next portion ("[A-Z]") means "followed by exactly one uppercase letter." The last portion ("[a-z]@>") means "followed by at least one lowercase letter that ends the word."
This pattern fulfills the camel-case definition of a single uppercase letter followed by lowercase letters, a single uppercase letter, and terminating lowercase letters. If you determine that your definition of camel case consists of a different pattern, then you only need to figure out the pattern and use that pattern in step 5, above.
If a single pattern may be a bit too restrictive—for instance, you might consider both SmartArt and iPhone to be camel-case words—they you might consider searching for just a portion of a word. In this case, use the pattern "[a-z][A-Z][a-z]" (without the quote marks) in step 5. This searches for a single lowercase letter followed by a single uppercase letter followed by a single lowercase letter. This pattern will find the "iPh" in "iPhone" and the "tAr" in "SmartArt." This should help you find any potential camel-case words in the document.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (11307) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and 2021.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
Find and Replace is a great tool, but what are you to do if your find or replace doesn't work as you expect? This tip ...
Discover MoreGot a table that contains rows you want to delete? Deleting one or two rows in a table is easy; deleting a bunch of rows ...
Discover MoreHTML tags are great when you want to display information on a web page. They are not so great when you have them in a ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments