0 votes
558 views

Dear reader. I would like to find \fq followed by any string thing including ɛ ɔ ɲ ŋ until the first \\ft followed by a space and then not followed by a colon.

Exemple phrase:

\fq cintɔnŋ Natan i ta ŋuŋ kɔnkɔli bo Solomani ŋununu \ft Walima ŋuŋ kɔri Solomani ŋununu

This regex \\fq.*\\ft\s[^\:] is much too greedy .... Any tips on how to limit the search to the first non-occurance?

Thanks in advance,

Bart

Paratext by (347 points) | 558 views

2 Answers

0 votes
Adding a ? after the * is used for non-greedy.
by (9.8k points)
Thanks for the tip Phil. I am still not there yet .... so I tried: regex:\\fq.*?\\ft\s[^\:] which results in (see below)

The search for  regex:\\fq.*?\\ft\s\: produces a nice list of results with \ft followed by a space and a colon. Indeed, after \ft there should be a space \s always followed by a colon. So, what should the regex be to find the absence of that one colon? My best guess is : regex:\\fq.*?\\ft\s[^\:] but it does not deliver the desired result ...

Any ideas?

Thanks in advance.
0 votes
When writing a regular expression it is important not to look for too much. When you search for a period it keeps look for anything that is not a new line (or if you are in the regex: search it will look for anything) until it comes to the next item. So the key is to try and search for something stops the search. Often I will use [^\\]* to search for anything that is not a backslash. This would work for you unless you have extra backslashes in your \fq before you get to the \ft. Note that I try to build my expressions in RegExPal so that I can see what is being found as I add to the expression.

Try this expression:

\\fq [^\\]*?\\ft\s[^:]
by (9.8k points)

Thank you Phil, that did find what I was looking for. I was also mistaken about the : which is not a metacharacter in regex. Actually, the regex \\fq [^\\]*?\\ft\s[^:] and the regex \\fq [^\\]*?\\ft\s[^\:] deliver the same (good) result, which I am trying to understand. So, just for the sake of a better understanding of this regex in PT:

does \s[^:] mean the first non-colon after a space?

then:

would \s[^\:] mean the first non-backslash followed by a colon? Or does it mean the first non-backslash followed by a non-colon?

Much obliged,

Bart.

When you put characters inside of the [] regex sees those as alternates (except for the ^ which is the NOT). So [^\:] says not a \ or not a :.  If you have something like t[aeiou]t  it would find a t followed by any of those letters and then another t.
Merci beaucoup.

Related questions

0 votes
8 answers 1.3k views
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 asked Aug 20, 2018
0 votes
2 answers 504 views
I received this email from a translator. I could write an elementary regex expression, but believe I would miss some ... me, I would greatly appreciate it. Thank you, james_post
[Moderator]
james_post
2.1k
asked Mar 30, 2023
0 votes
2 answers 681 views
L.S. As explained on the lingtrans wiki page, it is possible to use the location field in \fig Paratext to ... hoping for some regex input here as well. Thanks in advance.
goodgoan 347 asked May 3, 2021
0 votes
1 answer 213 views
Paratext help says, In the Search box on the toolbar, you can enter the text you want to find or the regular expression ... list? Thanks for any help you can give me on this.
john_nystrom 312 asked Jun 15, 2021
+1 vote
5 answers 826 views
I want to change lowercase to uppercase in certain situations - for instance I want to change all lowercase after a colon to ... very simple list and then adding to it as you go.
Phil_Leckrone 9.8k asked Mar 2, 2022
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
And I tell you that you are Peter, and on this rock I will build my church, and the gates of Hades will not overcome it.
Matthew 16:18
3,037 questions
5,994 answers
5,661 comments
2,022 users