Finding All Camel-Case Words

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:

  1. Press Ctrl+H to display the Replace tab of the Find and Replace dialog box.
  2. Display the Replace tab.
  3. Click the More button, if it is available.
  4. Make sure the Use Wildcards check box is selected.
  5. In the Find What box, enter "<[A-Z][a-z]@[A-Z][a-z]@>" (without the quote marks).
  6. Click on Find Next. Word finds the first occurrence.
  7. Continue clicking on Find Next, as desired.
  8. Close the Find and Replace dialog box.

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.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Screen Flip Flop with VBA

Word allows users to conveniently work with multiple documents at the same time. When writing macros, you may need to ...

Discover More

Opening Non-Excel Files

Not all data is created in Excel. Indeed, you may have data in files created by many other types of programs. You might ...

Discover More

Losing Data in a Shared Workbook

When you create a shared workbook, you run the risk of losing some of the data in that workbook. Here's a discussion ...

Discover More

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!

More WordTips (ribbon)

Replacing and Renumbering

Word has a powerful find and replace capability that can help you perform quite a few changes to your documents. This tip ...

Discover More

Applying Styles and Removing Characters using Find and Replace

The Find and Replace capabilities of Word are very powerful, allowing you to accomplish more than one task at a time. ...

Discover More

Keeping a Replace Operation Displayed

The Find and Replace tool is designed to help you find and replace information as quickly as possible. However, you may ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


This Site

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.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.