PDA

View Full Version : Compiling links- script? VBA? Macro?



Ben Spackman
09-02-2004, 05:58 PM
I have my own version with AI notes. What I'm trying to do is go through the txt file and replace ALL the cross-references (e.g. "Gen 3:16") with hyperlinked references that open in their own window. (I'm at work, so I can't reproduce the syntax of the thing here, it's something like <b link="Gen 3:16").

Since there are thousands of possible combinations, how would one write something to find/replace all these possibilities? Does anyone have such a thing?Thanks :)

vr8ce
09-02-2004, 08:49 PM
I have my own version with AI notes. What I'm trying to do is go through the txt file and replace ALL the cross-references (e.g. "Gen 3:16") with hyperlinked references that open in their own window. (I'm at work, so I can't reproduce the syntax of the thing here, it's something like <b link="Gen 3:16").

Since there are thousands of possible combinations, how would one write something to find/replace all these possibilities? Does anyone have such a thing?Thanks :)

All you need is a regex editor, and some patience. I would do each book individually myself; it makes it easier to undo an error and keeps the regexes readable. A given book should be pretty easy, e.g. "(Gen +[0-9]+:[0-9]+)" for the search, and "<b link=\1" for the replace. Replace the Gen above with each book abbreviation, save each one separately so you can get back to a known place, and you're there.

Or, if you have a version of sed/awk/perl handy (Google for win32 sed), you could write a script that would do all of them, i.e. something like
s/\(Gen *[0-9][0-9]*:[0-9][0-9]*\)/<b link=\1/g
s/\(Ex *[0-9][0-9]*:[0-9][0-9]*\)/<b link=\1/g
...

And so on, for all 66 books. Win32 versions of all three exist (see Google).

Vince

Ewan MacLeod
09-03-2004, 04:54 AM
All you need is a regex editor, and some patience.

If you know the vi editor, then there is a free OpenSource enhanced version called vim (see http://www.vim.org/) which can handle complex regular expressions (exactly the same as used for the 's' examples which Vince gave). Versions are available for Windows, Linux, etc. It can handle enormous files as well, and you can define macros for repetitive tasks like this.