Results 1 to 3 of 3

Thread: Compiling links- script? VBA? Macro?

  1. #1

    Default Compiling links- script? VBA? Macro?

    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
    Ben

  2. #2
    Join Date
    Apr 2004
    Posts
    128

    Default

    Quote Originally Posted by Ben Spackman
    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

  3. #3

    Default

    Quote Originally Posted by vr8ce
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •