0

I did read a lot of topics on this site regarding changing case, but none had a solution for Cyrillic letters.

Apparently \w, \u, \l and such only work for Latin characters; at least the replace part, it can find uppercase Cyrillic just fine.

What I'm trying to do is find all words with full UPPERCASE and turn them to Capitalized. I have a couple of ways to do it, but it doesn't work with Cyrillic. No matter what I try, it just replaces the character with the same one.

Any suggestions?

Kard Nails
  • 157
  • 1
  • 8
  • It won't work with non-ASCII letters. You need to use a full-fledged programmatic solution. Or, use the PythonScript within Notepad++. – Wiktor Stribiżew Sep 23 '21 at 11:14
  • Does `Edit > Convert Case to > Proper Case` not work for you? – 41686d6564 stands w. Palestine Sep 23 '21 at 11:16
  • If not all the text is Cyrillic or not all words will be replaced, you could copy the text to regex101.com, find `\b(\p{Lu})(\p{Lu}+)\b`, replace with `\1\L\2`, and then copy the result back to Notepad++. – 41686d6564 stands w. Palestine Sep 23 '21 at 11:24
  • @41686d6564, The file is huge and I have tens of thousands of replacements to do. Convert case is manual and has to be activated every time, right? All the characters are Cyrillic. – Kard Nails Sep 23 '21 at 11:25
  • @WiktorStribiżew Could you point me at a tutorial for it, or something explaining how to make it work? – Kard Nails Sep 23 '21 at 11:27
  • I'm not sure what you mean by "has to be activated every time". "Convert Case" is only useful if you want to convert all words in the file or if you only want to replace a few sections of the file. That probably won't work for your situation. – 41686d6564 stands w. Palestine Sep 23 '21 at 11:29
  • See [this answer of mine](https://stackoverflow.com/questions/37300462/notepad-find-replace-number-with-increment-value/37300757#37300757). – Wiktor Stribiżew Sep 23 '21 at 11:32

1 Answers1

2

Here's a hacky solution that will work in Notepad++ without additional tools:

  1. Open the "Find" dialog.

  2. Type in: \b[\x{0410}-\x{042F}]{2,}\b *.

  3. Click on Count.

  4. Get the number of matches.

  5. Open the "Macro" menu and click "Start Recording".

  6. Back in the the "Find" dialog, click Find Next.

  7. Go to Edit > Convert Case to > Proper Case or press Alt+U

  8. From the "Macro" menu, click "Stop Recording".

  9. (optional) Save the macro using Macro > Save Current Recorded Macro...

  10. Go to Macro > Run a Macro Multiple Times....

  11. Enter the number of matches found in step #3.

  12. Click Run.

  13. If the number of matches is greater than 9999, you'll need to click "Run" a few times until all matches are replaced.

Demo:

Demo of the above steps in Notepad++


* This is the range for the capital letters of the basic Cyrillic alphabet found here. If you need to match more letters (e.g., extensions), you'll need to add them to the character class. If you need to replace all UPPERCASE words, not just ones written in Cyrillic, you may use \b\u{2,}\b instead but remember to tick the "Match case" checkbox.