0 票
722 次浏览

Can someone answer definitively:

  • What flavour of regex is used in PT Find / Find-and-Replace when you prefix strings with “regex:”?
  • Can regexes be used in the Replace field?
  • If so, do \1, \2, etc work?

“Scope” in my title is to encourage people to comment on what is missing from the scope of regexes used in this context. See this example in a different thread.

较早的帖子 - 以原始语言显示
Paratext 中 由 (1.4k 分) 发布
已重新显示 | 722 次浏览

1 个回答

0 票
最佳答案

I believe it’s the same as Paratext uses. Don’t quote me on that.

There is no way to use regular expressions in the Paratext replace field.
Sorry.

较早的帖子 - 以原始语言显示
由 (571 分) 发布

No problem, we can use RegEx Pal*. I just wanted this information to be clearly recorded on this site. Now anyone can search for “regex in replace” or similar, and find your posting.

* Though I do wish that RegEx Pal could mark points in the Project History!.

较早的帖子 - 以原始语言显示

While Paratext does not currently mark a point in history automatically when RegExPal, you can get a point by either opening the History or marking a point in History… Then after the RegExPal replacement is done you again either open History or mark a point. Marking a point has the advantage of allowing you to indicate what change was being run at that point.

较早的帖子 - 以原始语言显示

Yes, that’s what I do – and I try to use consistent wording to make it neat.

But it’s good to have the suggestion recorded in this thread.

My point was that it would be nice if RegEx Pal did it, or had the option to, because sometimes I forget.

较早的帖子 - 以原始语言显示

Unfortunately, we use 2 different regular expression parsers between
Paratext and RegexPal - probably for historical reasons.

RegexPal uses Python regular expressions -
https://docs.python.org/2/library/re.html

Other code in Paratext uses .Net regular expressions -
https://msdn.microsoft.com/en-us/library/az24scfc(v=vs.110).aspx

An additional complication is that we use IronPython (a .Net implementation
of Python) when the Python searches, so we are reliant on some
conversion code that translates the Python expression to .Net equivalents.

Since users have lots of RegexPal expressions that currently work for them,
we haven’t wanted to change how it does it’s searching.

John+Wickberg
Paratext Support

较早的帖子 - 以原始语言显示

Since RegExPal is now a part of Paratext in version 7.6 and later, there is no technical reason it can’t be done. :smirk:

较早的帖子 - 以原始语言显示

@hindlemail informed me that we have actually already added in this functionality to Paratext 8.0. :flushed:

较早的帖子 - 以原始语言显示

I’m confused: your previous posing implied it had already been added to PT 7.6!

I see that in my 7.6 it’s on Tools ➢ Advanced, but is this any more than a shortcut to RegEx Pal?

较早的帖子 - 以原始语言显示
  1. RegexPal is part of PT 7.6
  2. In PT 8.0 RegexPal marks a point in project history before making changes.
较早的帖子 - 以原始语言显示

But can you tell us what this means? I notice that RegEx Pal is still a separate executable file. So I ask again: is the menu item in 7.6 any more than just a shortcut to the RegEx Pal executable?

Will there be any control over what and when it marks? If you are testing your regex, you probably don’t want a “Before doing …” marked point every time you click the First button!

In fact I wish that PT’s own Find-and-Replace would not mark a point if no replacements are made. I know that it normally marks two points, and the presence of only one marked Replace point means nothing was replaced, but it’s still a waste of space in the already-very-long Project History. (If you agree, go to my linked topic “Find-and-Replace: Stop it marking a point in Project History if no changes are made” – link is on the right, opposite the top of this post – and tell me in a reply.)

较早的帖子 - 以原始语言显示

Yes.
RegExPal executes in the same process as Paratext.

No control - but it smart enough to only do it before the first change is made. ( i.e. first time yes or yes all is clicked)

较早的帖子 - 以原始语言显示

相关问题

0 票
8 个回答 1.8k 次浏览
Can someone answer definitively: What flavour of regex is used in RegEx Pal? Scope in my title is to encourage people ... used in this context. See next post for an example.
wdavidhj 1.4k 发布 提问于 七月 20, 2016
0 票
1 个回答 255 次浏览
In Paratext 8, does changing the project scope after initial set up and after having begun registering progress in other books ... project scope (e.g., adding or removing a book)?
drwww 448 发布 提问于 五月 4, 2017
0 票
3 个回答 1.3k 次浏览
[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 票
4 个回答 675 次浏览
项目中的全大写文本(ALL CAPITAL TEXT)对于排版人员来说是大忌,原因有很多 他们完全可以在 InDesign 中使用样式将文本设置为全大写 然而,在进行打印草稿(Print Draft)或将文本上传到 DBL 供 YouVersion 使 ... 其他人希望在 Paratext 的正则表达式中获得大小写转换功能吗? 我应该将此提交为功能请求吗?
Kent Spielmann 1.8k 发布 提问于 十二月 20, 2017
0 票
1 个回答 363 次浏览
I'm working for the first time in PT with a right-to-left language project (I've only used RTL resources up to now). I ... Find string and the Replace string, and ␣ is a space.)
wdavidhj 1.4k 发布 提问于 七月 21, 2016
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Very truly I tell you, whoever accepts anyone I send accepts me; and whoever accepts me accepts the one who sent me.
John 13:20
3,055 个问题
6,014 个回答
5,677 条评论
2,033 位用户