Regex – Find Upper Case Followed by Its Lower Case Version
(?i:(\u)\1)(?<=(?-i:\u\l))
Beware the difference between 1 (one) and l (lower case L).
This makes use of two somewhat obscure features of Notepad++ regular expressions.
(?i:...) and (?-i:...) are used to make the included expressions case insensitive or case sensitive. Case sensitive or insensitive applies even to upper or lower case matches and back-references. So in the above expression, the first \u matches any letter, while the second \u matches only upper case letters.
(?<=...) is used to make a test against preceding characters (called a lookbehind). In this case, after finding two characters such that the first character is a letter and the second character is the same as the first (ignoring case), we look back to check that the first is uppercase and the second is lowercase.
\L$0 does not do what you think it does. In the find field, \L means any single character other than a lower case letter. The changing case function is only available in replacement strings. You can’t use the dollar sign that way, either, in the match field.
Read more here: Source link
