+1 票
177 次瀏覽

以下正則表達式可讓您在 Paratext 的「尋找」功能中使用 Remove From List,來比較兩個專案中 \nd …\nd* 的神聖名稱標記,以查看節中實例數量的差異。設定時需不設任何限制。如果勾選了 Match Only in Verse Text,則無法運作。

regex:(?<=\\v\s\S+\s)((?!\\(v|m?s|nd)).)*(\\nd [^\\]*?\\nd\*)){1,1}((?!\\(v|m?s|nd|c)).)*(?=\\(v|s|c)|\Z)

此正則表達式可讓您找到文本中具有指定數量 \nd 跨度的節:

  • {1,1} 僅一個
  • {1} 恰好一個(與上述相同)
  • {2,} 兩個或更多
  • {0,0} 無

它不會找到章節標題中的 \nd 標記,也不會找到 \+nd 標記

問題

  • 由於它不會找到 \+nd 標記,因此不會在一般文本中找到 \+nd(罕見)。
  • 它不會在緊接在章節標題之後的部分節中找到 \nd(罕見)。

以下正則表達式可在一般文本和腳註的 \+nd …\+nd* 跨度中找到 txt。

regex:(?<=\\v\s\S+\s)(((?!\\(v|m?s|\+nd)).)*(\\\+?nd [^\\]*?\\\+?nd\*)){1,1}((?!\\(v|m?s|\+nd)).)*(?=\\(v|m?s)|\Z)

問題

  • 由於它會找到 \+nd 標記,因此會在腳註中找到 \+nd(常見)。

如果我們想使用此方法來比較使用 \nd 標記的英文譯本與使用唯一未標記詞彙代表 YHWH 的譯本,我們可以在搜尋中加入該詞彙。對於法文,我們將搜尋 Eternel

regex:(?<=\\v\s\S+\s)(((?!\\(v|m?s|nd)|Eternel).)*(\\\+?nd [^\\]*?\\\+?nd\*|Eternel)){1,1}((?!\\(v|m?s|nd)|Eternel).)*(?=\\v|m?s)|\Z)

由於 Eternel 也出現在腳註中,我們希望跳過腳註中的文本。以下 Schema 可讓您在匹配時跳過文本(例如腳註跨度):

schema:(?<=<start>)(((?!<selector>).)*((<skipSpan>((?!<selector>).)*)*<requiredSpan>)){Min,Max}((?!<selector>).)*(<skipSpan>((?!<selector>).)*)*(?=<end>|\Z)

關於 <selector>,請參閱:正則表達式範例:匹配滿足特定要求的整行文本

如果您的條件是某行不應包含某些內容,請使用負向前瞻。^((?!regexp).)*$ 匹配不符合 regexp 的完整行。

讓我們將此應用於跳過腳註中的文本。我們必須匹配 \nd 和 \+nd 跨度以及 Eternel:

<start>         \\v\s\S+\s                         ; Start at verse
<end>           \\(v|m?s)                          ; End at verse or section heading 
<end>|\Z        \\(v|m?s)|\Z                       ; For final context add \Z to select end of Chapter
<requiredStart> \\\+?nd|Eternel                    ; \nd markup optionally embedded and "Eternel"
<requiredSpan>  (\\\+?nd [^\\]*?\\\+?nd\*|Eternel) ; The entire \nd phrase or "Eternel"
<skipStart>     \\f\s                              ; Beginning of a footnote
<skipSpan>      (\\f\s((?!\\f\*).)*\\f\*)          ; The entire footnote
<selector>      <end>|<skipStart>|<requiredStart>  ; Combine all of the selection restrictions 
    =>          \\(v|m?s)|\\f\s|\\\+?ndEternel     ; which simplifies to 
    =>          \\(v|m?s|f\s|\+?nd)|Eternel

完整正則表達式:
regex:(?<=\\v\s\S+\s)(((?!\\(v|m?s|f\s|\+?nd)|Eternel).)*(((\\f\s((?!\\f\*).)*\\f\*)((?!\\(v|m?s|f\s|\+?nd)|Eternel).)*)*(\\\+?nd[^\\]*?\\\+?nd\*|Eternel))){1,1}((?!\\(v|m?s|f\s|\+?nd)|Eternel).)*((\\f\s([^\\]|\\(?!f\*))*\\f\*)((?!\\(v|m?s|f\s|\+?nd)|Eternel).)*)*(?=(\\(v|m?s))|\Z)

機器翻譯自 English
Paratext 由 (1.8k 點) 提出
已重新顯示 | 177 次瀏覽

請 登入 或 註冊 以回答此問題。

相關問題

0 票
1 個回答 475 次瀏覽
A couple of days ago user 1 reported to me that in one PT8 project, the text direction somehow changed to ... are managed by two different organizations. How could this happen?
anon895417 129 提出 已提問 12月 4, 2017
0 票
8 個回答 2.3k 次瀏覽
We have a user who has inserted a lot of \pn and some \nd inside of footnotes. We now know we need those to be ... the search to inside of a single footnote? Thank you, MSEAIT/LT
MSEAIT_LT 478 提出 已提問 8月 20, 2018
0 票
0 個回答 175 次瀏覽
To compare the versions of a project in which there were changes: Click in the window of the project to make it the ... how-do-i-compare-a-word-or-phrase-in-different-projects/19)
[Expert]
anon421222
735 提出
已提問 2月 23, 2017
0 票
2 個回答 373 次瀏覽
在標題中使用 \pn 和 \nd 標記,會導致文字缺少其他文字所具有的某些字元屬性 例如,在 PrintDraft 和 Publishing Assistant 中,\pn \pn* 內的文字會顯示為斜體,但不像標題的其他部分那樣為粗體 ... 但在標題中使用會導致 Paratext 將這些標記顯示為紅色,即視為錯誤 這類標記應如何在標題中使用?
anon015155 153 提出 已提問 9月 26, 2018
0 票
2 個回答 737 次瀏覽
我需要找出每卷書的草稿完成百分比。只要計算每卷書中有多少節包含文字就足夠了。有沒有人能寫出一個正則表達式來完成這個任務? 感謝您提供的任何幫助。 John Nystrom
john_nystrom 312 提出 已提問 8月 21, 2024
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
There is neither Jew nor Gentile, neither slave nor free, nor is there male and female, for you are all one in Christ Jesus.
Galatians 3:28
3,054 個問題
6,014 個回答
5,677 則評論
2,033 位使用者