+1 票
176 次浏览

以下正则表达式允许您在 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 分) 发布
已重新显示 | 176 次浏览

请登录或注册以回答此问题。

相关问题

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 发布 提问于 十二月 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 发布 提问于 八月 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 发布
提问于 二月 23, 2017
0 票
2 个回答 373 次浏览
在标题中使用 \pn 和 \nd 标记会导致生成的文本缺少其余文本的其他字符属性 例如,在 PrintDraft 和 Publishing Assistant 中,\pn \pn* 内的文本会显示为斜体,但不会像标题的其他部分那样显示为粗体 ... ,但在标题中使用会导致 Paratext 将这些标记显示为红色,即视为错误 在标题中应如何使用此类标记?
anon015155 153 发布 提问于 九月 26, 2018
0 票
2 个回答 737 次浏览
我需要了解每卷书的草稿完成百分比。统计每卷书中有多少节包含文本就足够了。有人能写一个正则表达式来实现这个功能吗? 感谢大家提供的任何帮助。 John Nystrom
john_nystrom 312 发布 提问于 八月 21, 2024
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Dear friends, since God so loved us, we also ought to love one another.
1 John 4:11
3,054 个问题
6,014 个回答
5,677 条评论
2,033 位用户