Regex for bible reference in bible text

Discussion on theWord modules and other resources
gennesse
Posts: 103
Joined: Tue Jan 22, 2008 4:10 pm
Location: Nederland

Regex for bible reference in bible text

Post by gennesse »

Hi,
I am busy with a Bible text that has written Bible verse references like 1 corinthians 3:1, John 5:1 etc in it. To transform this in the necesary numbering format I was looking for a hint or tip how to search for the bible references and replace them with the needed numbering format like 1.1.1 (is Genesis 1:1). For example by doing a regex search and replace.

Any tips would be very helpfull,

Thanks in advance,
Richard
csterg
Site Admin
Posts: 8627
Joined: Tue Aug 29, 2006 3:09 pm
Location: Corfu, Greece
Contact:

Re: Regex for bible reference in bible text

Post by csterg »

Hm.... this does require code. It really depends on how many different types of references exist:
- are the book names consistent?
- are there ranges?
- are there chapter refs? (e.g. See Gen 3)

I have written code like that more than 5 times.... each time i need to convert a code. It is always slightly different. But it is code, not just a regex (code that does regex-es, etc)

Costas
gennesse
Posts: 103
Joined: Tue Jan 22, 2008 4:10 pm
Location: Nederland

Re: Regex for bible reference in bible text

Post by gennesse »

Hi Costas,
Thanks for your reply. In the Bibe I am working on there are footnotes where there are also verse references.
I have only very litle experience with coding (c programming) and do not know how to make use of it for editing text files etc :oops:
The verse references are consistent as far as I can see and there will also be verse ranges.
There are also chapter refs.

When I was reading the "Bible module Ref doc" again I got confused a little bit
What is meant with the q attribute where you talk about when explaining the RF tag? Does it mean that verse refernces will be automatically detected; because in that case I do not need to convert the Bible references in the numbered format? or does it mean something else?
<RF [q=<quote>]>…<Rf>: footnotes: they can appear anywhere in a verse. No formatting tags for text of footnotes. The q attribute is optional and can be used to denote the quote character (instead of the default numbering)
<RX b.c.v-v [q=<quote>]> (or <Rx>): cross-references. The book/chapter/verse index follows. They can appear anywhere in a verse. A range can be defined either using a dash (‘-‘) or a plus sign (‘+’). Dash denotes ending verse, plus denotes interval. For example:
<RX 1.1.1> refers to Gen. 1:1
<RX 1.1.3-4> refers to Gen. 1:3-4
<RX 1.1.3+1> refers to Gen 1:3-4
The q attribute is optional and can be used to denote the quote character, e.g.
<RX 1.1.1 q=a>
<RX 1.1.3-4 q=b>
If the q attribute is present, then instead of the usual numbers for the xrefs (1, 2, 3) the quote characters will appear instead (a, b, etc)
From version 3.1.3 onwards: the user has the ability to merge consecutive xrefs in a single popup. In that case, the q attribute of the first RX tag that has one will be used (if any). If you have consecutive RX tags and you need to separate them in multiple groups, add in between another tag (e.g. <b></b>), e.g:
<RX 1.1.1 q=group1><RX 1.1.2><b></b><RX 4.1.1 q=group2><RX 4.1.2>
csterg
Site Admin
Posts: 8627
Joined: Tue Aug 29, 2006 3:09 pm
Location: Corfu, Greece
Contact:

Re: Regex for bible reference in bible text

Post by csterg »

The q attribute defines what appears as the reference index. For, footnotes are numbered from 1 ... n, but you could want to use a different index value, like a, b, c...
Costas
gennesse
Posts: 103
Joined: Tue Jan 22, 2008 4:10 pm
Location: Nederland

Re: Regex for bible reference in bible text

Post by gennesse »

OK, thanks now I get it!
Post Reply