我希望在特定情況下將小寫字母改為大寫——例如,我希望將冒號後的所有小寫字母改為大寫。在 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
- 當文件運行時,它會突出顯示整個章節中找到的文字。如果您在「尋找/取代」中運行此操作,它會突出顯示找到的第一個項目和剩餘文字,但在取代面板中,它會顯示正在進行正確的替換。由於列表提供了替換內容,因此取代視窗應保持空白。
注意 我對這方面的實驗表明,我無法使用複雜的 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.
機器翻譯自 English