In this article, we want to introduce you 2 quick ways to find all words with initial or all letters capitalized in your Word document.
Capitalization is often seen in our documents. For example, some people prefer using capitalization to lay emphasis on important points. Besides, if you are looking through a government document, you will probably see many organization names in acronyms. The reasons to find words with initial or all letters capitalized are as follows:
- You may need to change capitalized words to other cases, such as small caps.
- Sometimes, there is no need to use capitalization all the time even as a way of emphasis.
- In a government proposal, it’s of great importance to recheck the correct spell and explanation of acronyms which are in all caps most time.
Therefore, just pick up the methods we are going to show you to get the job done.
Method 1: Utilize “Advanced Find” Features
This time we use wildcards to help us find all words either with initial or all letters capitalized.
- Firstly, click the arrow button next to “Find” command under “Home” tab.
- Then click “Advanced Find” to open the “Find and Replace” box.
- Next place cursor at the “Find what” text box. Enter “[A-Z]{2,}” to find all words with all letter capitalized. And enter “[A-Z]{1,}” to find all words with initial capitalized.
- Click “More” to bring out more options.
- Next check “Use wildcards” box.
- Then click “Find In” button and choose “Main Document”. You shall see words in selection now.
Note:
As you may notice that when using “[A-Z]{1,}” to find all words with initial capitalized, only capitalized letters are in selection, such as bellow:
An alternative option is replacing the wildcards with “[A-Z][a-z]{1,}” to find all words with initial capitalized. But its setback is that it finds only words over than one letter. For instance, letter “A” will not be recognized.
Method 2: Run Word Macro
Apart from method 1, you can also run macro to highlight all target words as to examine the proper usage.
- To start off, press “Ctrl+ Home” to go to the beginning of a document.
- Then press “Alt+ F11” to trigger the VBA editor.
- Next go to “Normal” project by clicking on it.
- Click “Insert” tab and select “Module”.
- Then double click the module to have the editing area on the right side available.
- Now paste the following codes there:
Sub FindAndHighlightAllCaps() Dim objRange As Range With Selection .HomeKey Unit:=wdStory With Selection.Find .ClearFormatting .Text = "[A-Z]{2,}" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found Set objRange = Selection.Range objRange.HighlightColorIndex = wdPink .Collapse wdCollapseEnd .Find.Execute Loop End With End Sub
- Lastly, click “Run”.
This macro will highlight words with all letters capitalized in pink.
To highlight all words with initial capitalized, use this macro instead:
Sub FindandHighlightCapitalizedWords() Dim objRange As Range With Selection .HomeKey Unit:=wdStory With Selection.Find .ClearFormatting .Text = "[A-Z]{1,}" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found Set objRange = Selection.Range objRange.HighlightColorIndex = wdBrightGreen .Collapse wdCollapseEnd .Find.Execute Loop End With End Sub
As to remove the highlight color, press “Ctrl+ A” to select the entire document. You can click “Home” tab first then click the “Text Highlight Color”. Next choose “No Color”.
Handle Word Errors
It’s such a shame that Word can run into errors every now and then. Therefore, it’s extremely necessary to know the right way to fix Word issues. One of the useful options is to acquire a repairing tool to recover corrupted files.
Author Introduction:
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupted xlsx and pdf repair software products. For more information visit www.datanumen.com
There is function to find capital letters in a word and and returns the index of that letter in the list.
def capslock(word):
res = []
for i,j in enumerate(word):
if j.isupper():
res.append(i)
return res
print(capslock("JDhfjkShh"))
[0,1,6]
I don’t understand why if you swap the loop variables in places (like that)
def capslock(word):
res = []
for j,i in enumerate(word):
if j.isupper():
res.append(i)
return res
print(capslock("JDhfjkShh"))
it gives me AttributeError: 'int' object has no attribute 'isupper'
I believe that the problem is that when the first variable is checked for the if condition in the loop and if the condition is met (the letter in the argument word is large), then the next variable remains empty and has nothing to return to result list . is my guess correct that first both variables should fall under the in enumerate function so that one variable checks the letter and the other puts it in the list — the result
I guess this is not a dumb question for a 6 day study.
updated:thanks for the feedback, you made it clear that this is still a stupid question, I will try not to distract you with this anymore
Post Views: 1,476
This article will guide you to find and highlight the words with First Capital letters or highlight only capital letters in Microsoft word application.
Capitalization is regularly found in our records. For instance, certain individuals are inclined toward utilizing capitalization to lay accentuation on significant focuses.
In addition, assuming you are glancing through an administration report, you will likely see numerous association names in abbreviations. The motivations to observe words with introductory or all letters promoted are as per the following:
You might have to change uppercase words to different cases, like little covers. Now and then, there is no compelling reason to utilize capitalization all the time even as a method of accentuation.
In an administration proposition, it’s critical to reevaluate the right spell and clarification of abbreviations that are in all covers most time.
Consequently, simply get the strategies we will show you to take care of business.
Contents
- 1 Trick 1: Use “Advanced Find” menu
- 2 Trick 2: Run Word Macro
- 2.1 Share this:
- 2.2 Like this:
This time we use wildcards to help us find all words either with initial or all letters capitalized.
- Firstly, click the arrow button next to “Find” command under “Home” tab.
- Then click “Advanced Find” to open the “Find and Replace” box.
- Next place cursor at the “Find what” text box. Enter “[A-Z]{2,}” to find all words with all letter capitalized. And enter “[A-Z]{1,}” to find all words with initial capitalized.
- Click “More” to bring out more options.
- Next check “Use wildcards” box.
- Then click “Find In” button and choose “Main Document”. You shall see words in selection now.
Trick 2: Run Word Macro
Apart from method 1, you can also run macro to highlight all target words as to examine the proper usage.
- To start off, press “Ctrl+ Home” to go to the beginning of a document.
- Then press “Alt+ F11” to trigger the VBA editor.
- Next go to “Normal” project by clicking on it.
- Click “Insert” tab and select “Module”.
This macro will highlight words with all letters capitalized in pink.
As to remove the highlight color, press “Ctrl+ A” to select the entire document. You can click the “Home” tab first then click the “Text Highlight Color”. Next, choose “No Color”.
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS
Contact US
Thanks. We have received your request and will respond promptly.
Log In
Come Join Us!
Are you a
Computer / IT professional?
Join Tek-Tips Forums!
- Talk With Other Members
- Be Notified Of Responses
To Your Posts - Keyword Search
- One-Click Access To Your
Favorite Forums - Automated Signatures
On Your Posts - Best Of All, It’s Free!
*Tek-Tips’s functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.
Posting Guidelines
Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Students Click Here
Finding capital letters in WordFinding capital letters in Word(OP) 12 Sep 07 14:13 Hi, Red Flag SubmittedThank you for helping keep Tek-Tips Forums free from inappropriate posts. |
Join Tek-Tips® Today!
Join your peers on the Internet’s largest technical computer professional community.
It’s easy to join and it’s free.
Here’s Why Members Love Tek-Tips Forums:
- Talk To Other Members
- Notification Of Responses To Questions
- Favorite Forums One Click Access
- Keyword Search Of All Posts, And More…
Register now while it’s still free!
Already a member? Close this window and log in.
Join Us Close
Detect correct capital letters in a word.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
private: | |
bool isCapital(char ch) { | |
return ((int)ch >= 65 && (int)ch <= 90); | |
} | |
public: | |
bool detectCapitalUse(string word) { | |
bool result = true; | |
bool foundLower = false; | |
int count = 0; | |
for (int i=0; i<word.length(); i++) { | |
char ch = word[i]; | |
if (isCapital(ch)) { | |
count++; | |
if (foundLower) { | |
// Found an upper-case letter after a lower-case: uSa | |
result = false; | |
break; | |
} | |
} | |
else if (count <= 1) { | |
// Found a lower-case letter and only 1 or 0 upper-case: usa or Usa | |
foundLower = true; | |
} | |
else { | |
// More than one upper-case letter and this one is lower-case: USa | |
result = false; | |
break; | |
} | |
} | |
return result; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given a word, you need to judge whether the usage of capitals in it is right or not. | |
We define the usage of capitals in a word to be right when one of the following cases holds: | |
All letters in this word are capitals, like «USA». | |
All letters in this word are not capitals, like «leetcode». | |
Only the first letter in this word is capital if it has more than one letter, like «Google». | |
Otherwise, we define that this word doesn’t use capitals in a right way. | |
Example 1: | |
Input: «USA» | |
Output: True | |
Example 2: | |
Input: «FlaG» | |
Output: False | |
Note: The input will be a non-empty word consisting of uppercase and lowercase latin letters. |
Please Note:
This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Using Find and Replace to Change Text Case.
Written by Allen Wyatt (last updated January 22, 2022)
This tip applies to Word 97, 2000, 2002, and 2003
David wanted to find words with an initial capital letter and change the initial capital letter to lowercase. Using wildcards, he wrote a Find string that correctly found capitalized words. However, David was unable to figure out how to change the initial capital to lowercase. He thought of using a Replace string, but didn’t know how to create one that would do that.
There is no way to do this in Word, at least not using Find and Replace by itself. The closest you can achieve is to create a macro that will use Find and Replace to step through all instances of your capitalized words and individually change the case of them.
You can, however, easily change the case of those letters by following these general steps:
- Press Ctrl+F to display the Find tab of the Find and Replace dialog box.
- Click the More button, if it is available. (See Figure 1.)
- Set up your wildcard search as you normally would to locate all the words that have the initial caps letter.
- In the dialog box, make sure you select the Highlight All Items check box.
- Use the drop-down list under the check box to select Main Document.
- Click Find All. Word selects all the words that match the pattern you specified in step 2.
- Press Esc to get rid of the Find and Replace dialog box. Your words should all still be selected.
- Press Shift+F3 as many times as necessary to get the capitalization the way you want it for the selected words.
Figure 1. The Find tab of the Find and Replace dialog box.
WordTips is your source for cost-effective Microsoft Word training.
(Microsoft Word is the most popular word processing software in the world.)
This tip (7535) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Using Find and Replace to Change Text Case.
Author Bio
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. Learn more about Allen…
MORE FROM ALLEN
Bogging Down with Calculated Items
Create a complex PivotTable and you may find that your system slows to a crawl. The reason for this may be due to the way …
Discover More
Excel 2010 PivotTables for the Faint of Heart (Table of Contents)
PivotTables are a powerful tool for consolidating huge amounts of data. PivotTables 2010 for the Faint of Heart …
Discover More
Fields in Footnotes Won’t Update Automatically
Fields can be very helpful for including dynamic information in your documents, such as cross-references. It can be …
Discover More
More WordTips (menu)
Counting a Particular Word
Need to know how many times a particular word appears in a document? Here’s a handy trick that will tell you the count, …
Discover More
Saving Find and Replace Operations
Want to repeat the same Find and Replace operation over and over again? Here are a couple of ways you can improve your …
Discover More
Selective Formatting in Searches
Need to search for text that has different formatting within the search term? Word can’t handle something this complex, …
Discover More
In this post, we will learn how to extract uppercase words in string Python with examples. We have used Regular expression to extract capital words from a given string.” A regular expression (or RE) specifies a set of strings that matches it; the functions in this module let you check if a particular string matches a given regular expression”.We will cover extracting uppercase words from lists in Python, extracting alphanumeric uppercase words from strings in Python, Extract Only uppercase letters from strings in Python, Count uppercase letters from strings in Python
In this example, we have extracted all uppercase words from Python string using Regular expression. In such a case first, we have to import the Regular expression module in our program using “import re”.The regular expression is as follows. The re module findall() function will return the word that matches the given pattern.
- [A-Z]: It extracts capital letters between A-Z.
- b: Start of word
import re strText = 'Welcome to DEVENUM.COM,LET FIND UPPER CASE STRING'; print(re.findall(r'b[A-Z]+(?:s+[A-Z]+)*b', strText))
Output
['DEVENUM', 'COM', 'LET FIND UPPER CASE STRING']
2. How to extract uppercase words in string Python using Regex
In this example, We are using the Regular expression ‘[A-Z]+’ to extract the uppercase letter and upper words from a string. Let us understand code and output.
import re myStr = "Welcome folks'S TO DEVENUM! HOW ARE YOU" pattern = '[A-Z]+' print(re.findall(pattern, myStr))
Output
[' TO DEVENUM', ' HOW ARE YOU']
3. Extract uppercase words from list in Python
To extract uppercase words from a list in Python. We have iterated over the list using for loop and on each iteration, we have extracted uppercase words using the Regular expression using the re.findall() function and display the result.
import re mylist = ['Welcome','to','DEVENUM','COM','LET', 'FIND','CASE'] for item in mylist: print(re.findall(r'b[A-Z]+(?:s+[A-Z]+)*b', item))
Output
[] [] ['DEVENUM'] ['COM'] ['LET'] ['FIND'] ['CASE']
4. Extract uppercase alphanumeric words of string in Python
We have used alphanumeric words from a string.We have used Regular expression [A-Z0-9][A-Z0-9]+|b[A-Z] where 0-9 used to include digit while matching the string.
import re myStr = "Welcome D2'S TO D56EV ENUM! H69OW A89E Y20OU" pattern = '[A-Z0-9][A-Z0-9]+|b[A-Z]*b' print(re.findall(pattern, myStr))
Output
['D2', 'TO', 'D56EV', 'ENUM', 'H69OW', 'A89E', 'Y20OU']
5. Extract Only uppercase letters from string Python
To find all the upper case letters from a string. We have used the filter function along with lambda and checked if the character in a string is uppercase using isupper() method. To return a list we have converted the result to a list using the list() method.
strText = 'Welcome to DEVENUM.COM'; def Is_upper_Letter(myStr): return list(filter(lambda char: char.isupper(), myStr)) print(Is_upper_Letter(strText))
Output
['W', 'D', 'E', 'V', 'E', 'N', 'U', 'M', 'C', 'O', 'M']
6. Count uppercase letters in string Python
To find the count of uppercase letters in a given string. We have iterated over each character of the string by using generator expression. When the upper case character is found, return the character to the sum function and when iteration is over, the sum function will return the count of all upper case letters in the string.
strText = 'Welcome to DEVENUM.COM'; UpperCase_count = sum(1 for item in strText if item.isupper()) print('Upper case letter in String :',UpperCase_count)
Output
Upper case letter in String :11
Summary
In this post, we have learned How to extract uppercase words in string Python by using regular expressions and findall() function of the re module. We have also covered, extracting uppercase words from lists in Python, extracting alphanumeric uppercase words from strings in Python, Extract Only uppercase letters from strings in Python, Count uppercase letters from strings in Python
Someone in one of my online editing groups wanted to find all the acronyms and initialisms in their document—any word comprising two or more capital (‘cap’) letters (e.g. AB, CDEF, GHIJK, etc.). They wanted a command that would find each one so they could check it (possibly against a glossary), then click Find Next to jump to the next one.
Wildcards to the rescue!
Here’s how:
- Press Ctrl+H to open the Find and Replace window.
- Click the Find tab (we only want to find these, not replace them with anything else).
- Click More to show further options.
- Select the Use wildcards checkbox.
- In the Find what field, type: <[A-Z]{2,}>
- Click Find next to find the first string of two or more caps.
- Keep clicking Find next to jump to the next string of two or more caps.
How this works:
- The opening and closing arrow brackets (< and >) specify that you want a single whole word, not parts of a word. Without these, you would find each set of caps (e.g. in the string ABCDEF, you would find ABCDEF, then BCDEF, then CDEF, then DEF, then EF, before moving on to the next set of caps).
- [A-Z] specifies that you want a range (the [ ] part) of caps that fall somewhere in the alphabet (A-Z). If you only wanted capped words that started with, say, H through to M, then you’d change the range to [H-M] and all other capped words starting with other letters would be ignored.
- {2,} means you want to find capped words with at least two letters in the specified range (i.e. A-Z). If you only wanted to find two- and three-letter capped words, then you’d change this to {2,3}, and all capped word of four or more letters would be ignored. By not specifying a number after the comma, the ‘find’ will find capped words of any length containing at least two letters.