Jump to content

Please read the Forum Rules before posting.

Photo
- - - - -

Inserting line breaks before numbers in a text


4 replies to this topic

#1 Hiroshi.Rio

Hiroshi.Rio

    Liking e-Sword

  • Veterans
  • PipPip
  • 22 posts
  • LocationRio, Brazil
Offline

Posted 14 December 2013 - 11:24 AM

I downloaded a bible and I'd like to convert it to e-sword. It is a .txt and the verses has no breaks (example bellow).

 

I'd like to inserting line breaks before numbers because do this manually would be painful. I found an answer on google but I do not how to implement it (http://stackoverflow...mbers-in-a-text)

 

So does anyone know an app to do this? 

 

Mateus 1
1 Esta é a lista dos antepassados de Jesus Cristo, filho de David, filho de Abraão. 2 Abraão foi pai de Isaac, Isaac foi pai de Jacob e Jacob foi pai de Judá e dos seus irmãos. 3 Judá foi pai de Peres e de Zera, sendo a mãe Tamar. Peres foi pai de Hesron e Hesron foi pai de Rame. 4 Rame foi pai de Aminadab, Aminadab foi pai de Nachon e Nachon foi pai de Salmon. 5 Salmon foi pai de Booz, sendo a mãe Raab. Booz foi pai de Obed, sendo a mãe Rute. Obed foi pai de Jesse (…)


#2 Josh Bond

Josh Bond

    Administrator

  • Administrators
  • PipPipPipPipPip
  • 2,890 posts
  • LocationGallatin, TN
Offline

Posted 14 December 2013 - 11:36 AM



I downloaded a bible and I'd like to convert it to e-sword. It is a .txt and the verses has no breaks (example bellow).

 

I'd like to inserting line breaks before numbers because do this manually would be painful. I found an answer on google but I do not how to implement it (http://stackoverflow...mbers-in-a-text)

 

So does anyone know an app to do this? 

 

Using Microsoft Word's regular expressions, you can do this. CTRL-F in Word.

 

You may need to navigate to Advanced Find.

 

Click the More button near the bottom of the window.

 

Check the Use Wildcards option.

 

Find: . ([0-9])

Replace: . ^p\1

 

Attached File  word-help.jpg   332.5K   14 downloads

 

After replacing:

 


1 Esta é a lista dos antepassados de Jesus Cristo, filho de David, filho de Abraão.

2 Abraão foi pai de Isaac, Isaac foi pai de Jacob e Jacob foi pai de Judá e dos seus irmãos.

3 Judá foi pai de Peres e de Zera, sendo a mãe Tamar. Peres foi pai de Hesron e Hesron foi pai de Rame.

4 Rame foi pai de Aminadab, Aminadab foi pai de Nachon e Nachon foi pai de Salmon.

5 Salmon foi pai de Booz, sendo a mãe Raab. Booz foi pai de Obed, sendo a mãe Rute. Obed foi pai de Jesse (…)

 



#3 Hiroshi.Rio

Hiroshi.Rio

    Liking e-Sword

  • Veterans
  • PipPip
  • 22 posts
  • LocationRio, Brazil
Offline

Posted 14 December 2013 - 01:19 PM

Thanks a lot, Josh. Worked pretty well. 

 

Just let me know if I am doing something wrong: the formula "Find: . ([0-9]) Replace: . ^p\1" replace verses ending in '.' (point), right? 

 

So what I am doing is changing it to: 

Find: , ([0-9]) Replace: , ^p\1 or

Find: ? ([0-9]) Replace: ? ^p\1

 

and other terminations like:   ;   :   "   ?"   !"   to change other verses. Is is correct? 



#4 Josh Bond

Josh Bond

    Administrator

  • Administrators
  • PipPipPipPipPip
  • 2,890 posts
  • LocationGallatin, TN
Offline

Posted 14 December 2013 - 03:26 PM



Thanks a lot, Josh. Worked pretty well. 

 

Just let me know if I am doing something wrong: the formula "Find: . ([0-9]) Replace: . ^p\1" replace verses ending in '.' (point), right? 

 

So what I am doing is changing it to: 

Find: , ([0-9]) Replace: , ^p\1 or

Find: ? ([0-9]) Replace: ? ^p\1

 

and other terminations like:   ;   :   "   ?"   !"   to change other verses. Is is correct? 

 

To account for differences in punctuation:

 

Find: ([.,;\!\?]) ([0-9])

Replace\1^p\2

 

But then if you have quotation marks after ? or !, then maybe just do the search/replace one at a time, like you suggested.

 

Just remember, when using a ? or ! as a literal character, you must escape it with a \. So don't search for ?. You would search for \? so Word knows its a literal character and not a variable (or what Word calls a wildcard).

 

Your question mark and exclamation examples:

 

Find: \? ([0-9]) 

Replace? ^p\1

 

Find: \([0-9]) 

Replace: ! ^p\1

 

All of this is predicated on one big assumption. This assumes the Bible text will never have some punctuation and then a number that's not a verse number. If it does, you will have to correct it manually.

 

For example, the following text would create a false positive:

 

Sample sentence here. 14 of them were gone.

 

If you have a sentence beginning with a number, and it's not a verse number, that will be problematic. I doubt that would be an issue with this Bible text, though.



#5 Hiroshi.Rio

Hiroshi.Rio

    Liking e-Sword

  • Veterans
  • PipPip
  • 22 posts
  • LocationRio, Brazil
Offline

Posted 14 December 2013 - 05:50 PM

Josh, I tested other formula that solved it in one step. ​I noticed that there is space before the verse number, no matter how it ends the previous verse (exclamation, comma etc.). So I used:

 

Find: ([0-9]) -- [one space]([0-9])

Replace:^p\1 -- [no space]^p\1

 

But as you said it would create a false positive. But I think all number on this bible are written without abbreviation. At this time I am converting NT only. So it would not be a problem. 

 

Thanks one more time. The 'use wildcards' is a very interesting feature that I did not know even existed.





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users




Similar Topics



Latest Blogs