0
246 次浏览
25年前我学会了 CC 表格,并且变得相当熟练。现在我正试图跟上时代,学习正则表达式,因为我在某处得到了一种印象,认为 PTXPrint 中的 changes.txt 使用了正则表达式。然而,我在某个教程网站上(终于)让正则表达式按我期望的方式工作的那些表达式,当我把它们放入 changes.txt 时似乎不起作用。简单的一对一替换没有问题,但当我尝试在 > 的一侧使用(例如)括号,然后在另一侧使用反向引用 \1 时,它不起作用。我怀疑我遗漏了关于 PTXPrint 中特定实现语法的细节。有没有关于 changes.txt 语法的文档?或者它支持正则表达式的哪个子集?

附言 - 我设法让我的表达式在 PTX 中的 Reg Ex Pal 中也能工作。
机器翻译自 English
PTXprint (206 分) 发布
已编辑 发布 | 246 次浏览

2 个回答

0
我自己解决了这个问题。似乎更改的两侧都需要用双引号将整个正则表达式括起来,而不仅仅是字面量。我仍然想知道是否在某处有更多关于此的文档。例如,我知道 "at GAL 1:5 ....",但似乎我在某处(也许是在某个视频中)看到了使用不同于 "at" 的介词的东西。我很想知道那些可能是什么,但绝望地无法再次在视频或 PowerPoint 幻灯片中找到它。我还想知道在引言材料中定位单个段落的语法是什么。可以在 Adjust lists(例如 GAL 0.1  -1[13])中做到这一点,但这种语法似乎在 changes.txt 中不起作用。再次,我不希望为每个小细节都打扰大家,所以我很想知道所有这些都写在哪里。
机器翻译自 English
(206 分) 发布
已编辑 发布
0

Yes, indeed, we do support Regex (and specifically the python flavour). You are correct that backslash codes such as \p must be escaped with a \ so that they appear as \\p.

Here are some examples of the kinds of things that you can do:

# Make space before last word in a section heading a Non-breaking space.
"(\\s( \S+)+) (\S+\s*\r?\n)"  > "\1\u00A0\3"

# If you only want the 3-letter book code to appear in the alternate header \h1 field (to help with typesetting)
"(\\id (...).+\n)" > "\1\\h1 \2\r\n"

# Change any normal \p at the start of chapters which really look like they should be no-break paragraph \nb
# at 2CO  2:0; 2CO  7:0; COL  2:0; COL  4:0; HEB 10:0  "\\p" > "\\nb"

# Shrink the paragraph starting at EXO 29:2 by 2%
at EXO 29:1 "\\p" > "\\p^98"

# Remove the \b after a \d within the book of PSA
at PSA "(\\d .+?[\r\n])\\b[\s\r\n]" > "\1"

# Remove \b after a \s section heading
"(\\s .+?[\r\n])\\b[\s\r\n]" > "\1"

# Just for certain books, insert a page break BEFORE the title of the Introductory Outline
at MAT; ROM; 1CO; PHP; COL "(\\iot )" > "\\pb\r\n\1" 

# Only for *some* books, it looks better if chapter 1 starts on its own page
at MRK; JHN; 1TI; JAS "(\\c 1 ?\r?\n)" > "\\pb\n\1"

# Wrap \io lines that are too long:
at MRK in "\\io\d [^\\]+\\ior": "ఆని పణిఙని" > "ఆని\u2028పణిఙని"
at LUK in "\\io\d [^\\]+\\ior": "బోదిసి, జబ్బుది" > "బోదిసి,\u2028జబ్బుది"

# Insert an em-dash surrounded by a couple of spaces before the ch:vs range of \io1 and \io2
# Note that this uses the IN notation, which restricts the change to only happen WITHIN the context specified.
# This is a very useful trick to make complex rules much simpler by specifying where they can apply first.
in "\\io\d .+[\r\n]": "\s([0-9]+:[0-9:\-]+)" > "~~\u2014~~\1"

# Use Small-caps instead of ALLCAPS
"CHAKRAMANG" > "\\sc Chakramang\\sc*"
at EXO 3:14 "IAWNGUOWI" > "\\sc Iawnguowi\\sc*"
at EXO 28:36, 29:6 "CHAKRAMANG VÜI CHIMSAIMA" > "\\sc Chakramang Vüi Chimsaima\\sc*"

# Shrink these paragraphs* by 3% 
# (*actually it is the \p which appears before the NEXT verse which gets shrunk)
at LEV 7:10; 13:44; 14:0; 16:19,22; 20:13,18; 24:0; 26:26; 27:8 '\\p(\s)' > '\\p^97\1'

Most of the above is documented in the slides within this massive slide stack.

(3.2k 分) 发布
感谢您指出“幻灯片堆栈”。我会花些时间研究一下,看看我还能从中学到什么。这些示例也有助于扩展我的正则表达式视野。我仍然对 CC 表格感到怀旧,但我会克服这种情绪。
机器翻译自 English
引用引言段落

相关问题

0
3 个回答 1.1k 次浏览
[There is no Help topic for RegEx Pal, so I'll start this thread for myself or anyone else to add helpful ... History panic (post #3) Key terms for search: regular expression
wdavidhj 1.4k 发布 提问于 六月 5, 2019
0
10 个回答 2.2k 次浏览
Is there are way to get the expressions on the User menu in RegEx Pal as a text file? The list of user ... . The latter could help us build a library of useful expressions.
wdavidhj 1.4k 发布 提问于 九月 10, 2015
0
1 个回答 227 次浏览
Paratext 帮助文档指出:“在工具栏的搜索框中,您可以输入要查找的文本或要匹配的正则表达式。” 我需要能够找到所有不包含单词 “gloss” 的项目注释。在注释列表的文本筛选窗口中,我应该使用什么正则表达式来实现这一点?感谢提供任何帮助。
john_nystrom 312 发布 提问于 六月 15, 2021
0
2 个回答 228 次浏览
(Robert Hunt writes) I installed PT7.5 on Win-XP as administrator, but run as a regular user. However, it keeps ... like Update is downloading but never seems to get anywhere.
匿名用户 发布 提问于 四月 10, 2015
0
2 个回答 154 次浏览
我有过几次这样的经历:我编写的正则表达式在 RegEx Pal 和 Regex101.com(Python 风格)中都能正常工作,但在 PTXPrint 中却无法运行。这似乎与它处理回车符、换行符或反斜杠的方式有关。其他人是否也有过这种经历,或者量化过这种差异?
mvk1000 206 发布 提问于 六月 30, 2025
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Give proper recognition to those widows who are really in need.
1 Timothy 5:3
3,049 个问题
6,007 个回答
5,672 条评论
2,029 位用户