For example, there are many lines of the form: Термин — определение
. How do regular expressions in Notepad ++ make the термин
written in capital letters - ТЕРМИН
?
- It describes how to do this: stackoverflow.com/questions/1039226/… or look for notepad ++ regexp replace uppercase - ReinRaus
2 answers
Tested on Sublime Text 3.
Suppose that “term” and “definition” consist of any characters except for a line break (since, according to the author’s conditions, the line itself consists of “Term - definition”). Then:
To find:
(.*?)( — .*)
Replace:
\U$1\E$2
It was:
Россия — Москва Гаити — Порт-О-Пренс Соломоновы острова — Хониара 4. тринидад и тобаго — Порт-оф-Спейн
It became:
РОССИЯ — Москва ГАИТИ — Порт-О-Пренс СОЛОМОНОВЫ ОСТРОВА — Хониара 4. ТРИНИДАД И ТОБАГО — Порт-оф-Спейн
Demonstration:
Explanations:
(.*?)
- any 0 or more characters except for line breaks, a lazy quantifier is used;( — .*)
- space - dash - space - any 0 or more characters except for line breaks.\U$1\E
- the contents of the first subexpression are converted to upper case;$2
- the second subexpression remains unchanged.
There shouldn't be any problems with the support of the search pattern, but in the regular expression of the replacement, case-change meta-characters are used:
\U
translate to upper case,\E
first uppercase letters,\L
translate to lower case.
The meta replacement symbols in the table are a specific feature of some text editors; this is non-standard behavior for regular expressions.
Table of support for meta-characters replacement
│ \U │ \E │ \L ──────────────┼─────┼─────┼────── Notepad++ │ + │ - │ + SublimeText3 │ + │ + │ +
Do you really need regulars? Just there you can find all the matches of what you need (ctrl + f) and convert the register (ctrl + shift + u)