Montag, 2. Oktober 2017

Convert all words first letter to upper case (RegEx & Notepad++)

From time to time we need to replace the first letter of many words to the upper case.

String: "word1" "word2" "word3 and/or word4"

Find part: "\b(\w)(\w+)"

Replace part: "\u$1\E$2"

Result: "Word1" "Word2" "Word3 And/Or Word4"


If we want to exclude any word, e.g and, or, so we can make this so:

String: "word1" "word2" "word3 and/or word4"

Find part: "\b(?!and|or)(\w)(\w+)"

Replace part: "\u$1\E$2"

Result: "Word1" "Word2" "Word3 and/or Word4"