Tested today. Your fix seems to have nailed it. Not only does it deal with the nested tags properly it now runs much faster. In fact it runs so fast now I thought it was broken. When I used to old program it took about 10 minutes to parse a bible file this latest version takes maybe 10 seconds.
John 3:13 looks good along with other texts with nested tags like John 4:24 , John 4:35 John 2:8 etc. So far I have found no issues. I'll update you if I do.
Thanks again. You've changed a pretty good bible app into a fantastic one for me.
I appreciate the update and the explanation of your fix.
Thanks. I replaced the script in the original post with this version. The faster running is due to the fact that I now do a BEGIN in the beginning and a COMMIT in the end. In the earlier version every INSERT was written to disk separately.