Word only using capital letters

I am new to RegExp. I have a sentence and I would like to pull out a word which satisfies the following —

  1. It must contain only one capitalized letter
  2. It must consist of only characters/letters without numbers

For instance —
«appLe», «warDrobe», «hUsh»

The words that do not fit — «sf_dsfsdF», «331ffsF», «Leopard1997», «mister_Ram» et cetera.

How would you resolve this problem?

asked Dec 12, 2022 at 5:37

Alan Anderson's user avatar

The following regex should work:

  • will find words that have only one capital letter
  • will only find words with letters (no numbers or special characters)
  • will match the entire word
b(?=[A-Z])[A-Z][a-z]*b|b(?=[a-z])[a-z]+[A-Z][a-z]*b

Matches:

appLe
hUsh
Harry
suSan
I

Rejects

HarrY     - has TWO capital letters
warDrobeD - has TWO capital letters
sf_dsfsdF - has SPECIAL characters
331ffsF   - has NUMBERS
Leopd1997 - has NUMBERS 
mistram   - does not have a CAPITAL LETTER

See it in action here

Note:

If the capital letter is OPTIONAL- then you will need to add a ? after each [A-Z] like this:

b(?=[A-Z])[A-Z]?[a-z]*b|b(?=[a-z])[a-z]+[A-Z]?[a-z]*b

answered Dec 12, 2022 at 6:02

ScottC's user avatar

ScottCScottC

3,9161 gold badge6 silver badges19 bronze badges

2

You can do this by using character sets ([a-z] & [A-Z]) with appropriate quantifiers (use ? for one or zero capitals), wrapped in () to capture, surrounded by word breaks b.
If the capital is optional and can appear anywhere use:

/b([a-z]*[A-Z]?[a-z]*)b/   //will still match empty string check for length

If you always want one capital appearing anywhere use:

/b([a-z]*[A-Z][a-z]*)b/    // does not match empty string

If you always want one capital that must not be the first or last character use:

/b([a-z]+[A-Z][a-z]+)b/    // does not match empty string

Here is a working snippet demonstrating the second regex from above in JavaScript:

const exp = /b([a-z]*[A-Z][a-z]*)b/
const strings = ["appLe", "warDrobe", "hUsh", "sf_dsfsdF", "331ffsF", "Leopard1997", "mister_Ram", ""];

for (const str of strings) {
  console.log(str, exp.test(str))
}

Regex101 is great for dev & testing!

answered Dec 12, 2022 at 6:25

Arleigh Hix's user avatar

Arleigh HixArleigh Hix

9,5921 gold badge14 silver badges31 bronze badges

RegExp:

/b[a-z-]*[A-Z][a-z-]*b/g

Demo:

RegEx101

Explanation

Segment Description
b[a-z-]*
Find a point where a non-word is adjacent to a word ([A-Za-z0-9-] or w), then match zero or more lowercase letters and hyphens (note, the hyphen needs to be escaped (-))
[A-Z]
Find a single uppercase letter
[a-z-]*b
Match zero or more lowercase letters and hyphens, then find a point where a non-word is adjacent to a word

answered Dec 12, 2022 at 6:47

zer00ne's user avatar

zer00nezer00ne

41.1k6 gold badges44 silver badges66 bronze badges

English Capitalization Rules:

  1. Capitalize the First Word of a Sentence.
  2. Capitalize Names and Other Proper Nouns.
  3. Don’t Capitalize After a Colon (Usually)
  4. Capitalize the First Word of a Quote (Sometimes)
  5. Capitalize Days, Months, and Holidays, But Not Seasons.
  6. Capitalize Most Words in Titles.

Contents

  • 1 What are the 10 rules of capitalization?
  • 2 How do you write capital correctly?
  • 3 How do I use capital letters in Word?
  • 4 What are the 4 reasons to use capital letters?
  • 5 What are 5 rules of capitalization?
  • 6 How do you write capital letters on a computer?
  • 7 What are the seven main uses of capital letters?
  • 8 How do you capital letters in Excel?
  • 9 Why is shift F3 not working?
  • 10 Why do we write capital letters?
  • 11 Do capital letters matter in email address?
  • 12 Should I be written in capital letters?
  • 13 Do you capitalize president of a club?
  • 14 Do you put capital letter after comma?
  • 15 Does a capital come after?
  • 16 Do you capitalize job titles in a sentence?
  • 17 What capital letter means?
  • 18 How do you capitalize the first letter on a laptop?
  • 19 What is it called when you capitalize every word?
  • 20 Why is Grandpa Joe capitalized?

What are the 10 rules of capitalization?

What are the 10 rules of capitalization?

  • Capitalize the first word of a sentence.
  • Capitalize proper nouns and names.
  • Capitalize the majority of titles.
  • Capitalize events and periods.
  • Capitalize “I” as a pronoun.
  • Capitalize any locations and direct addresses.
  • Capitalize family relationships.

How do you write capital correctly?

We always write the first person pronoun as a capital I.
Use a capital letter for days of the week, months of the year, holidays:

  1. Monday, Tuesday.
  2. January, February.
  3. Christmas.
  4. Armistice Day.

How do I use capital letters in Word?

How to change uppercase and lowercase text in Microsoft Word

  1. Highlight all the text you want to change.
  2. Hold down the Shift and press F3 .
  3. When you hold Shift and press F3, the text toggles from sentence case (first letter uppercase and the rest lowercase), to all uppercase (all capital letters), and then all lowercase.

What are the 4 reasons to use capital letters?

Capital letters are useful signals for a reader.
Capital Letters

  • Capitals signal the start of a new sentence.
  • Capitals show important words in a title.
  • Capitals signal proper names and titles.

What are 5 rules of capitalization?

English Capitalization Rules:

  • Capitalize the First Word of a Sentence.
  • Capitalize Names and Other Proper Nouns.
  • Don’t Capitalize After a Colon (Usually)
  • Capitalize the First Word of a Quote (Sometimes)
  • Capitalize Days, Months, and Holidays, But Not Seasons.
  • Capitalize Most Words in Titles.

How do you write capital letters on a computer?

For capital letters, hold down the ‘shift’ key and hold and type the letter. For symbols at the top of a number key, press down the symbol key and then type the symbol. You can use the ‘shift’ key to type any symbol at the top of a key. The ‘caps lock’ key allows you to write in capital letters.

What are the seven main uses of capital letters?

  • CAPITALIZATION.
  • Capitalize the first word in a sentence or a direct quote.
  • Capitalize the names of commercial products.
  • Capitalize names that show family relationships or titles when they can be replaced with a proper noun.
  • Original Sentence: Cannot Be Replaced with:

How do you capital letters in Excel?

In cell B2, type =PROPER(A2), then press Enter. This formula converts the name in cell A2 from uppercase to proper case. To convert the text to lowercase, type =LOWER(A2) instead. Use =UPPER(A2) in cases where you need to convert text to uppercase, replacing A2 with the appropriate cell reference.

Why is shift F3 not working?

Shift F3 Not Working When The “Fn” Key Is Locked
2.Fn + Caps Lock. Fn + Lock Key (A keyboard key with only a lock icon on it) Press and Hold the Fn key to enable/disable.

Why do we write capital letters?

As capitalization rules evolved after the invention of the printing press in the 1700s, the letter I retained its capitalization, but none of the personal pronouns received the same special treatment. The letter I continues to be capitalized because it is the only single-letter pronoun.

Do capital letters matter in email address?

No. Email addresses are not case sensitive. Having letters in all lowercase makes the email address easier to read, but the oversight won’t stop your messages from being delivered.

Should I be written in capital letters?

The word ‘I’ is not a proper noun, it’s a pronoun. In English ‘I’ is always capitalised. In many other languages the equivalent word is not capitalised.

Do you capitalize president of a club?

According to English capitalization rules, proper nouns are always capitalized. Therefore, when referring to a person with the title President, always capitalize the word.

Do you put capital letter after comma?

No. You don’t have to capitalize words after commas everytime. Only when there is a proper noun (a name of an individual person, place, organization, etc) after a comma, you have to capitalize it.

Does a capital come after?

If the word that comes after a colon or semi-colon is a proper name, you definitely would capitalize it.To put it slightly differently, you aren’t starting a new sentence when you use a colon or semi-colon, so you would only use capitals in the places you ordinarily would.

Do you capitalize job titles in a sentence?

Titles should be capitalized, but references to the job are not. For instance, if you are using a job title as a direct address, it should be capitalized.Title references that immediately precede the person’s name should also be capitalized.

What capital letter means?

Capital letters, also called upper-case letters, are larger than, and often formed differently from, lower-case letters. Capital letters are used at the beginning of a sentence or a proper name and may be used to show respect.

How do you capitalize the first letter on a laptop?

Change case

  1. Select the text for which you want to change the case.
  2. Go to Home > Change case .
  3. Do one of the following: To capitalize the first letter of a sentence and leave all other letters as lowercase, click Sentence case. To exclude capital letters from your text, click lowercase.

What is it called when you capitalize every word?

CamelCase Words are written without spaces, and the first letter of each word is capitalized. Also called Upper Camel Case or Pascal Casing.

Why is Grandpa Joe capitalized?

Why is “Grandpa Joe” capitalized? It’s a general version of a word. It’s a proper noun. It’s not a specific person’s name.

Turn Caps lock text back to normal

When you are working on a Microsoft PowerPoint Presentation or Word document, it is frustrating to type a section of text only to realize that all of the texts are typed in uppercase. Rather than retyping the all-caps text, Office Word/PowerPoint has a built-in option to fix the problem. This is so simple you will wonder why you have never used it before.

How did it happen?

Perhaps your PowerPoint theme was applied the All Caps font property.

How to Fix?

Use shortcut key: Ctrl+Shift+A should remove it.

Alternatively, you can select the text, and then on the Home tab, in the Font group, click the arrow in the lower-right corner. In the Font dialog box, under Effects, cancel to check the All caps box to turn caps lock text back to normal.

Turn caps lock text to normal

How to Change Case of Text in Word or PowerPoint

MS Office program makes it simple to automatically change some or all of the texts to a different case, such as all lowercase. The office supports two different methods for changing the case of text that you have already entered into your presentation or document. These methods are:

  • Using shortcut keys on your keyboard
  • Using the Home tab Font section

Change Case Using Shortcut Keys

Both PowerPoint and Word support the Shift+F3 shortcut in Windows to toggle between the three most common selections for changing text case: Sentence case, uppercase (all caps), lowercase and a version of title case (in which each word is capitalized).

Highlight the text to switch and press Shift+F3 to cycle between the settings.

Change Case Using the Ribbon

To change the case of selected text in a document or presentation from the ribbon, do the following:

Select the text for which you want to change the case.

On the Home tab, in the Font group, click Change Case (Aa).

Change case of text

Select your choice from the drop-down list from these five options:

  • To capitalize the first letter of a sentence and leave all other letters as lowercase, click Sentence case.
  • To exclude capital letters from your text, click lowercase.
  • To capitalize all of the letters, click UPPERCASE.
  • To capitalize the first letter of each word and leave the other letters lowercase, click Capitalize Each Word.
  • To shift between two case views (for example, to shift between Capitalize Each Word and the opposite, cAPITALIZE eACH wORD), click tOGGLE cASE.


Change Case of Text in Office Word/PowerPoint turn caps lock text back to normal

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:

  1. You may need to change capitalized words to other cases, such as small caps.
  2. Sometimes, there is no need to use capitalization all the time even as a way of emphasis.
  3. 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.Find All Words with Initial or All Letters Capitalized

Method 1: Utilize “Advanced Find” Features

This time we use wildcards to help us find all words either with initial or all letters capitalized.

  1. Firstly, click the arrow button next to “Find” command under “Home” tab.
  2. Then click “Advanced Find” to open the “Find and Replace” box.Click "Home"->Click the arrow button->Click "Advanced Find"
  3. 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.
  4. Click “More” to bring out more options.
  5. Next check “Use wildcards” box.
  6. Then click “Find In” button and choose “Main Document”. You shall see words in selection now.Enter codes in "Find what" text box->Check "Use wildcards" box->Click "Find In"->Choose "Main Document"

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:Only capitalized letters being in selection

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.

  1. To start off, press “Ctrl+ Home” to go to the beginning of a document.
  2. Then press “Alt+ F11” to trigger the VBA editor.
  3. Next go to “Normal” project by clicking on it.
  4. Click “Insert” tab and select “Module”.Click "Normal"->Click "Insert"->Click "Module"
  5. Then double click the module to have the editing area on the right side available.
  6. 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
  1. Lastly, click “Run”.Paste codes->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”.Click "Home"->Click "Text Highlight Color"->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

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.

  1. Firstly, click the arrow button next to “Find” command under “Home” tab.
  2. Then click “Advanced Find” to open the “Find and Replace” box.
  3. 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.
  4. Click “More” to bring out more options.
  5. Next check “Use wildcards” box.
  6. 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.

  1. To start off, press “Ctrl+ Home” to go to the beginning of a document.
  2. Then press “Alt+ F11” to trigger the VBA editor.
  3. Next go to “Normal” project by clicking on it.
  4. 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”.

Like this post? Please share to your friends:
  • Word online что это за программа
  • Word online скачать бесплатно для windows 10 торрент
  • Word online редактор текста
  • Word online редактировать документ
  • Word online проверка орфографии