You are here: PSPad forum > English discussion forum > General: "Bible" regex

General: "Bible" regex

#1 General: "Bible" regex

Posted by: PSPad | Date: 2022-03-21 15:32 | IP: IP Logged

General: "Bible" regex issue
I need some help from a regular expression.
How to separate verses into single lines?
You may notice the number of verses. How to change it to single lines?

5 Kim jest Apollos? I kim jest Paweł? Sługami, dzięki którym uwierzyliście i którzy wykonali tylko to, co każdemu z nich zlecił Pan. 6 Ja zasadziłem, Apollos podlał, ale to Bóg dawał wzrost. 7 Dlatego nie liczy się ani ten, kto sadzi, ani ten, kto podlewa, tylko Bóg, który daje wzrost. 8 Ten, kto sadzi, i ten, kto podlewa, mają jeden cel, ale każdy otrzyma zapłatę stosownie do własnego trudu. 9 Bo my jesteśmy Bożymi współpracownikami. A wy jesteście Bożym polem uprawnym, wznoszoną przez Boga budowlą.
10 Dzięki niezasłużonej życzliwości, jaką Bóg mnie obdarzył, niczym wprawny budowniczy położyłem fundament, lecz ktoś inny na nim buduje. Ale niech każdy zwraca uwagę, w jaki sposób na nim buduje. 11 Bo nikt nie może położyć żadnego innego fundamentu oprócz tego, który już położono, a którym jest Jezus Chrystus. 12 A czy ktoś na tym fundamencie buduje ze złota, srebra, drogocennych kamieni, drewna, siana, czy słomy — 13 to się okaże, gdy przyjdzie dzień próby. Właśnie wtedy stanie się jawne, jakie jest dzieło każdego, bo wyjawi to ogień — wypróbuje jakość tego, co każdy zbudował. 14 Jeśli czyjeś dzieło, zbudowane na tym fundamencie, przetrwa, ktoś taki otrzyma zapłatę. 15 Jeśli czyjeś dzieło spłonie, ktoś taki poniesie stratę. Sam się uratuje, ale będzie to tak, jakby został uratowany z ognia.

Options: Reply | Quote | Up ^


#2 Re: General: "Bible" regex

Posted by: vbr | Date: 2022-03-21 16:39 | IP: IP Logged

Unfortunately, there are some limitations in handling linebreaks via search and replace in PSPad. In this case, to insert a new line break before each number (hopefully, there are any other in the text...) you can
place the cursor at the end of the original text, set the search direction "Backward" and perform the
regex replace:
(\d+)

REPLACE WITH:

\n$1

hth,
vbr

Options: Reply | Quote | Up ^


#3 Re: General: "Bible" regex

Posted by: PSPad | Date: 2022-03-21 18:14 | IP: IP Logged

Maybe there is still a small fix that will take into account the limit of only two-digit 0-99 numbers?
And improve detection by knowing that there is always a space and a period before a number (verse)!
This prevents unexpected matches numbers and verses in the text.

Edited 5 time(s). Last edit at 2022-03-21 18:18 by PSPad.

Options: Reply | Quote | Up ^


#4 Re: General: "Bible" regex

Posted by: PSPad | Date: 2022-03-21 18:30 | IP: IP Logged

It should be corrected regex because it removes the period at the end of sentences
Example:
Find\. \d{2}
Replace with:
\n$1

Edited 3 time(s). Last edit at 2022-03-21 18:36 by PSPad.

Options: Reply | Quote | Up ^


#5 Re: General: "Bible" regex

Posted by: Andreas | Date: 2022-03-30 08:52 | IP: IP Logged

Use this page to do your replacements in realtime.
regex101.com
Then copy the result and paste it into pspad.

Options: Reply | Quote | Up ^


#6 Re: General: "Bible" regex

Posted by: PSPad | Date: 2022-04-01 12:42 | IP: IP Logged

Unexpected result
([0-9]{1,3})

test. 12 test test 20 test test
12 is the verse number
20 is a number in any text

Edited 1 time(s). Last edit at 2022-04-01 12:43 by PSPad.

Options: Reply | Quote | Up ^


#7 Re: General: "Bible" regex

Posted by: pspad | Date: 2022-04-01 13:41 | IP: IP Logged

Unexpected answer.
Please write a question so that it is possible to answer it. Nobody sees into your head and I have a my crystal sphere in repair

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR