I want to convert the text to lowercase
, but it contains Cyrillic characters and remains uppercase
.
RegEx sandbox: https://regex101.com/r/GFuZYc/1
How do I change the replace
parameter to make it work?
The text is:
WWWWWWWWW
wwwwwWWWWWWWwwwwwww
wwwwwwwwwwwwww
ЫЫЫЫЫЫЫЫЫЫЫ
ыыыыыыыыЫЫЫЫЫЫЫЫЫыыыыыыыы
Find:
(\w+|[ыЁёА-я]+)
Replace:
\L$1
Result:
wwwwwwwww
wwwwwwwwwwwwwwwwwww
wwwwwwwwwwwwww
ЫЫЫЫЫЫЫЫЫЫЫ
ыыыыыыыыЫЫЫЫЫЫЫЫЫыыыыыыыы
Notepad++:
This is not possible by default, because Notepad++ doesn't have built-in support for handling Unicode characters like Cyrillic characters directly in regex.
Notepad++ workaround:
Try this:
Install PythonScript
Plugin.
Create a PythonScript: Once the PythonScript plugin is installed, you can create a new PythonScript by going to Plugins > PythonScript > New Script
.
Write Python code for the created Script, which handles the wished task: editor.rereplace(r'(\w+|[ЁёА-я]+)', lambda m: m.group(0).lower()
)
Run the Script: Go to Plugins > PythonScript > Scripts > YourScriptName
to run the script.
Side info: Javascript:
In Javascript, you can use toLocaleLowerCase()
, which handles Unicode characters properly. This will correctly convert both Latin and Cyrillic characters to lowercase:
let text = "WWWWWWWWW\nwwwwwWWWWWWWwwwwwww\nwwwwwwwwwwwwww\nЫЫЫЫЫЫЫЫЫЫЫ\nыыыыыыыыЫЫЫЫЫЫЫЫЫыыыыыыыы";
let lowercaseText = text.toLocaleLowerCase();
console.log(lowercaseText);