0 votes
220 views

(Phil Leckrone writes)

a) how much of:

    1. Alpha; 2. Beta; 3. Gamma

will:

   \d.*\d

match?

b) Can RegEx Pal match text that spans more than one verse?

I’m checking a project (the keying in of an older text) where the key-er has started every verse of direct speech with a open quote continuer – which is not in the original, and not correct for this language. If RegEx Pal cannot span verses, I guess there’s no way to fix this automatically … but it will be a lot of work to correct it manually.

Paratext by | 220 views

2 Answers

0 votes

(Phil Leckrone writes)

  1. Regular Expressions tend to be “greedy” in general. If you use * then you will continue to search as long as possible until you come to the next item. If you want to make a search “not greedy” then you would use *? to stop after the first possible match.

  2. A regular expression can span verses or other markers - this depends on what you are using to search with. In RegExPal, the “.” stops at a newline. Therefore it won’t span a verse if there is a newline before the \v.

You can make a dot match a newline if you start the regular expression with “(?s)”.

NOTE: if you search using “regex:” in Paratext then the “.” does not automatically stop at a line break. To make it stop at a newline you need to use: “regex:(?-s)”

If you Google “RegEx Cheat Sheet” you can find some useful guides.

by
0 votes

a)

\d.*\d

will match

  1. Alpha; 2. Beta; 3

(and maybe more if there is another number in the text line) since .* is greedy.

\d.*?\d 

will match

1. Alpha; 2

always.

b) Yes. there are many way to span a verse (RegexPal cannot span a chapter)
method 1: use (?s).*?
method 2: use an expression to find everything except the character you want to find and then put the character you want to find after that:

For example, this is how I would start to find double open quote continuers:

(?<=“[^“”]*?)“(?=[^”]*?”)

and then

(?<=“[^“”]*?)“

The first will will not find continuers at the beginning of a chapter nor continuers in chapters that continue to a following chapter
The second will pick up continuers in chapters that continue to a following chapter and then you will need to manually delete the continuer at the beginning of the following chapter.

If there are quotes in footnotes, this may not work properly. One solution would be to change all quotes in footnotes to different characters, then change them back after removing the continuers from the text. This then would be the whole process:

(?<=\\f\s).*?(?=\\f\*):::“ to <<
(?<=\\f\s).*?(?=\\f\*):::” to >>
(?<=“[^“”]*?)“(?=[^”]*?”) to <nothing> (repeat this until no more continuers are found)
(?<=“[^“”]*?)“  Use this to find chapters that begin with continuers and do manual cleanup
(?<=\\f\s).*?(?=\\f\*):::<< to “
(?<=\\f\s).*?(?=\\f\*):::>> to ”
by (1.8k points)
reshown

Related questions

0 votes
3 answers 377 views
We have a problem with language IDs not matching which prevents the Interlinearizer from working. The KPZ project was registered ... or how I can look at those changes. Iver+Larsen
Iver Larsen 869 asked Jan 24, 2020
0 votes
10 answers 1.0k views
Screenshot.PNG1680 1001 126 KB I am trying to use the Match Based on Stems tool in my project, but it does not seem ... no more work involved. Can anyone help me get this to work?
anon807810 155 asked Jul 12, 2018
0 votes
5 answers 572 views
In our project's Biblical Terms list, I'm looking for an (easier) way to filter for terms which contain too many ... \r\n and filter more specifically that way? Any suggestions?
Mark P 3.2k asked Jul 4, 2017
0 votes
1 answer 129 views
I have a regex that can extract all the figures in my Paratext project: \\fig .*\\fig\* I would like to have a ... . Thanks for any help you can give me on this. John Nystrom
john_nystrom 312 asked Nov 6, 2024
0 votes
2 answers 614 views
I need to find out what percentage of each book has been drafted. A count of how many verses in each book have text ... Thanks for any help you can give me on this. John Nystrom
john_nystrom 312 asked Aug 21, 2024
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
I appeal to you, brothers and sisters, in the name of our Lord Jesus Christ, that all of you agree with one another in what you say and that there be no divisions among you, but that you be perfectly united in mind and thought.
1 Corinthians 1:10
3,037 questions
5,995 answers
5,661 comments
2,022 users