Я хочу изменить строчные буквы на заглавные в определённых ситуациях — например, я хочу изменить все строчные буквы после двоеточия на заглавные. В RegEx Pal нет одного правила, которое позволило бы мне сделать это, но есть недокументированная функция, которая позволяет создать список простых изменений для выполнения. (ПРИМЕЧАНИЕ: существуют регулярные выражения, которые могут сделать это, но не в RegEx Pal.)
- Создайте текстовый документ с записями, которые следуют этому формату:
# I can use the # to add comments to the list
: a-->: A
: b-->: B
: c-->: C
То, что находится слева, отделено от того, что находится справа, с помощью -->
- После сохранения этого файла вы можете использовать его в окне поиска RegEx Pal, введя:
-->{Path}\{Filename}
For instance:
-->c:\My Paratext 8 Projects\zzProj\shared\changes.txt
- При запуске файла будет выделен текст, найденный во всей главе. Если вы выполните это в режиме Find/Replace, будет выделен первый найденный элемент и оставшийся текст, но в панели замены будет показано, что выполняются правильные замены. Окно замены следует оставить пустым, так как список предоставляет замену
ПРИМЕЧАНИЕ Мои эксперименты с этим показали, что я не мог использовать сложные символы Unicode. Если я хотел выполнить изменение, такое как:
Jesus-->Jesús
Мне пришлось сохранить текстовый файл в формате ANSI, иначе ú было бы искажено в тексте.
Также
Хотя я мог включать пробелы слева от дефиса-дефиса, я не мог включать пробел в конце правой части — он удалялся при обработке. И если я хотел искать слева точку или вопросительный знак, их сначала нужно было экранировать:
\. a-->. A
\? a-->? A
Скорее всего, есть и другие вещи, которые могут работать не совсем так, как ожидается. Если вы хотите попробовать это, я рекомендую начать с очень простого списка, а затем добавлять к нему по мере продвижения.
I want to change lowercase to uppercase in certain situations - for instance I want to change all lowercase after a colon to uppercase. There is no single rule that I can use in RegEx Pal to accomplish this, but there is an undocumented feature that lets me create a list of simple changes to run. (NOTE: there are regular expressions that can do this, but not in RegEx Pal.)
- Create a text document with entries that follow this format:
# I can use the # to add comments to the list
: a-->: A
: b-->: B
: c-->: C
What is on the left is separated from what is on the right by -->
- Once you save this file you can use it in the search window of RegEx Pal by typing:
-->{Path}\{Filename}
For instance:
-->c:\My Paratext 8 Projects\zzProj\shared\changes.txt
- When the file runs it will highlight text found in the entire chapter. If you run this in a Find/Replace then it will highlight the first item found and remaining text, but in the replace panel it will show that it is doing correct replacements. The replace window should be left blank since the list is providing the replacement
NOTE My experiments with this showed that I could not use complex Unicode characters. If I wanted to do a change like:
Jesus-->Jesús
I had to save the text file in ANSI format or else the ú would be corrupted in the text.
Also
While I could include spaces on the left side of the hyphen hyphen, I could not include a space at the end of the right side - it would get removed in the processing. And if I wanted to search on the left for a period or question mark, these had to be escaped first:
\. a-->. A
\? a-->? A
There are probably other things that may not work quite like expected. If you want to try this, I suggest starting with a very simple list and then adding to it as you go.