When you are developing skills in a language it sometimes quite interesting to have to solve problems over which you have no control or influence (and which are not made up examples out of a text book).
I could spend my time playing Soduku but your problem was much more interesting.
You may get some false or failed hits. This will be where the references don't conform to the rules derived from the reference texts.
Its easy to find the stem of a reference (e.g. John 1:1) but then defining what happens after that depends on your consistency.
The search actually returns 1 more character than the stem reference e.g. 'John 1:1-' and we use the last character to determine what we need to do next.
Last character of found text is
;.) or space then a complete reference has been found
- then we need to find ending verse and assume a following abbreviated reference
, then an abbreviated reference is next
Once you've devined these rules its just a case of encoding the logic (without getting youself in a tangle) whilst avoiding words little foibles.
|