Notepad++中字符后转大写及冒号后字母转大写的实现方法
Hey there! Let's break down how to solve your two Notepad++ tasks easily using regular expression replacements—they're perfect for these kinds of text transformations.
1. Convert content after each character to uppercase in Notepad++
If you mean converting all content after the first character of each line to uppercase (e.g., turning hello world into hELLO WORLD), here's how to do it:
- Open your file in Notepad++ and press
Ctrl+Hto open the Replace dialog. - At the bottom left, check the Regular expression option (and uncheck ". matches newline" if it's selected).
- In the Find what field, enter:
^(.)(.*)$ - In the Replace with field, enter:
$1\U$2 - Click Replace All to apply the change to your entire document.
How this works:
^(.)captures the first character of each line.(.*)captures all remaining content on the line.\U$2converts the captured remaining content to uppercase, while$1keeps the first character as-is.
2. Capitalize the first letter after every colon (:) in each line
For your specific example (turning nerd:class:ace make:milk lake:cake into nerd:Class:Ace make:Milk lake:Cake), follow these steps:
- Open your file in Notepad++ and press
Ctrl+Hto open the Replace dialog. - Check the Regular expression option (leave ". matches newline" unchecked).
- In the Find what field, enter:
:\K([a-z]) - In the Replace with field, enter:
\U$1 - Click Replace All to update all instances.
Alternative method (if you prefer):
You can also use this pair if the first one feels unfamiliar:
- Find what:
(:)([a-z]) - Replace with:
$1\U$2
How this works:
:\Ktells Notepad++ to match the colon but exclude it from the replacement (so we don't retype the colon).([a-z])captures the first lowercase letter immediately after the colon.\U$1converts that captured letter to uppercase.
内容的提问来源于stack exchange,提问作者Maestro Bm
相关产品推荐
相关产品推荐

