Written by Allen Wyatt (last updated October 2, 2021)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, and Word in Microsoft 365
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 Word in Microsoft 365.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
Word has a powerful find and replace capability that can help you perform quite a few changes to your documents. This tip ...
Discover MoreThe Find and Replace capabilities of Word are very powerful, allowing you to accomplish more than one task at a time. ...
Discover MoreThe Find and Replace tool is designed to help you find and replace information as quickly as possible. However, you may ...
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 © 2024 Sharon Parq Associates, Inc.
Comments