TIP of the day - weekend redux: Power Tip: Using variables to Search and Replace in Word

MJ. Smith
MJ. Smith Member, MVP Posts: 53,043 ✭✭✭✭✭
edited November 20 in English Forum

I created a Personal Book from a class I took this semester on the Acts of the Apostles. The professor's class notes used the European format for citing the Bible, where it is common to say Acts 1,1 instead of Acts 1:1.

Given that Logos Personal Books don't understand this format, I found myself with the difficulty of trying to replace all the commas with semicolons.<sic> Luckily with Microsoft Word this is extremely easy.

I told Microsoft Word to search for every occurrence of "a number followed by a comma followed by a number" and replace it with the same numbers, but with a semicolon in between.

Here is what the search looks like. Notice that the "Use Wildcards" option is selected.

There is documentation on doing this type of search and replace here: http://office.microsoft.com/en-us/word-help/find-and-replace-text-by-using-regular-expressions-advanced-HA102350661.aspx

This technique can also be used to insert the codes which Personal Books need to indicate that a certain heading is, for example, a Dictionary Head Word. If all the head words in your dictionary have the same formatting, in just a matter of a few minutes of work you could apply the information that the Logos Personal Book needs to recognize 1000s of head words.

(1-9) /1 What's this really mean in plain English...Thanks for your ideas and any help you msy be able to render

[0-9] indicates that Word should look for any single number, anywhere from 0-9. As there is a space following the [0-9], Word will also look for a space. Also notice that the "Superscript" format is being searched for.

The \1 refers to the first Wildcard search it did above (in this case "[0-9]" without the space).

What Word will do with this search is look for Superscript formatted text that consists of any number plus a space. It will then replace it with that same number without the space.

What's special about this search is that it will replace "1 " with "1", "2 " with "2 ", etc., all with just one search.

In my search it is just slightly more complicated. It is looking for any number followed by a comma and then followed by any number. It will replace it with the same two numbers but with a colon inbetween instead of the comma. In my case the replace string is "\1:\2". \1 refers to the first number, \2 to the second, and so on. Notice that this 1 search and replace that I did would otherwise have required 100 different search and replaces had I not used variables.

Again, more documentation and examples are here: http://office.microsoft.com/en-us/word-help/find-and-replace-text-by-using-regular-expressions-advanced-HA102350661.aspx

I was curious about the formatting question in Europe, so I investigated a little bit. Here's what I found.

From what I've been able to discover, in German, French, Italian, Spanish, and Portuguese the typical citation format is Acts 1,1 with a comma, not a colon.

In English of course the colon prevails. Even so, there are certain references to the comma being used instead of the colon as a possibility in English, especially in Europe. BTW, in Dutch it seems that the colon is also standard.

Not really the topic of this thread, but nevertheless something that Logos might want to look into adapting for, especially if they get more into the mainland European languages.

The Logos PB builder supports autodetection of bible references in European notation in some languages (e.g. Czech), but not all.

(an adaptation of the technique)

To remove the trailing space, I added a space at end of the "Find What" term. The "Replace With" term has no trailing space. Problem solved, so long as Logos keeps putting a superscript space after the superscript number. And since I don't care whether the number is single or double digit (this Find What only finds the least significant digit), it works slick.

Orthodox Bishop Alfeyev: "To be a theologian means to have experience of a personal encounter with God through prayer and worship."; Orthodox proverb: "We know where the Church is, we do not know where it is not."