Power Tip: Using variables to Search and Replace in Word

Fr Devin Roza
Fr Devin Roza MVP Posts: 2,419
edited November 2024 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. 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.

Tagged:

Comments

  • Robert M. Warren
    Robert M. Warren Member Posts: 2,459 ✭✭✭

    Thanks for sharing this. I had not seen that type of citation style before, so now i'll be keeping an eye out for it.

    Using the variables is also handy for bible milestones. The key, as you have indicated, is consistent formatting.

    macOS (Logos Pro - Beta) | Android 13 (Logos Stable)

    Smile

  • fgh
    fgh Member Posts: 8,948 ✭✭✭

    the European format

    Please don't call it "the European format". It's as foreign to me as it is to Americans, if not more.

    I found myself with the difficulty of trying to replace all the commas with semicolons.

    You mean 'colons', not 'semicolons', but beside that:

    Personally, I would definitely prefer if people who prepare PB files for sharing didn't do that. It makes them useless for academic purposes, where quotes have to be exact. (What people do with their private PB files is, of course, up to them.)

    Another problem may be that complicated references may end up distorted if one doesn't check very carefully beforehand how the author has chosen to write such.

    The better method is to use search and replace to create a tag looking like [[Acts 1,1 >> Acts 1:1]].

    Mac Pro (late 2013) OS 12.6.2

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    fgh said:

    the European format

    Please don't call it "the European format". It's as foreign to me as it is to Americans, if not more.

    Didn't mean to offend. I've studied theology and Scripture in Europe for 4 years in 2 different universities and have seen this format used very often, almost exclusively in fact. I've never seen it in stuff from the US, however. It seems to be especially common in writings from Romance Languages, although I've seen it used in English writings as well (as in this case). It could be that it's something typical of the Romance Languages more than Europe per se, and which at times makes it into English documents due to the Romance Languages being so present here in Europe.

    fgh said:

    The better method is to use search and replace to create a tag looking like [[Acts 1,1 >> Acts 1:1]].

    If you know a quick way to do this please share. It becomes especially complicated when you get one citation after another, something which the simple solution I proposed handles perfectly (as "complicated references" get a space after the comma when it is not a Scriptural citation). In my case, for example, I replaced 1700 Scriptural citations with a format that Logos understands in a matter of minutes (most of the time being spent going through manually about 50 find and replaces to make sure I wasn't getting false positives), making the document extremely useful within Logos without spending much time. Perfect for many, many scenarios.

    BTW, the point of this post was more to share a method to quickly do intelligent search and replace in Word than to propose that this is something valid for every document and every case. As you pointed out, there are times in which this particular search would not be useful. But the goal is to open up peoples eyes so that they can apply the principles here in the scenarios that they encounter.

    If you or others want to share more examples of how you would do so in more complicated scenarios I'm sure it could be very helpful.

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    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.

  • NB.Mick
    NB.Mick MVP Posts: 16,153

    Thanks for sharing this - I'm a long-time user of word, but wasn't aware of the ability to use regular expressions in searches.

    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

    Judging from other threads, you may add Czech to your list of languages that use the European notation.

    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.

    Have joy in the Lord! Smile

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    NB.Mick said:

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

    That's great news. What do you need to do to force this type of detection in the PB Builder? Change the language of the document in Word to Czech and turn auto-detection of the language off?

  • Robert M. Warren
    Robert M. Warren Member Posts: 2,459 ✭✭✭

    NB.Mick said:

    The Logos PB builder supports autodetection of bible references in European notation in some languages

    I was also happy to discover that the PB compiler also automatically detects citations using Roman numerals, (e.g. John iii. 16), which I find in Owen's work. Maybe it's a Puritan thing, but I have also seen it as late as the late 1950s in a work by J.I. Packer.

    macOS (Logos Pro - Beta) | Android 13 (Logos Stable)

    Smile

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    NB.Mick said:

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

    I ran a few tests, but was not able to make this work. I tried to import English documents with the Acts 1,1 format as if they were Spanish, or Czech, etc (the text still being in English). Logos either did not recognize the references at all, or recognized them wrong (i.e. Acts 1,1 Logos understands as Acts 1).

    I then created a brief document in Spanish with "Hechos 1,1" and a few other similar citations, and imported it into Logos PBB, setting the language in PBB to Spanish. Same problem, Logos was expecting the "Hechos 1:1" format.

  • NB.Mick
    NB.Mick MVP Posts: 16,153


    NB.Mick said:

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

    I ran a few tests, but was not able to make this work.

    Devin,

    according to my tests, the PB compiler just looks at the document language you give when you complie the document and disregards the Word settings.

    I'm not on my Logos computer right now to show you with screenshots, but you may have a look in the following thread: http://community.logos.com/forums/p/48257/357856.aspx#357856 - I linked to the post that shows Czech references

    Hope this helps,

    Mick

    Have joy in the Lord! Smile

  • BillS
    BillS Member Posts: 3,805 ✭✭✭

    This technique can also be used

    Thanks so much! I adapted the technique to remove trailing spaces after superscript verse numbers. Works great!

    I'd wondered how to use wild cards... your post led me to try them, & it's powerful! 

    Thanks again!

    [H] [8-|]

    Grace & Peace,
    Bill


    MSI GF63 8RD, I-7 8850H, 32GB RAM, 1TB SSD, 2TB HDD, NVIDIA GTX 1050Max
    iPhone 12 Pro Max 512Gb
    iPad 9th Gen iOS 15.6, 256GB

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    Glad it could be of use. If you have a moment, post a screenshot of your search and replace window.

    I think it would probably be helpful if we can get together a bunch of examples.

  • BillS
    BillS Member Posts: 3,805 ✭✭✭

    post a screenshot of your search and replace window

    image

    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.

    Grace & Peace,
    Bill


    MSI GF63 8RD, I-7 8850H, 32GB RAM, 1TB SSD, 2TB HDD, NVIDIA GTX 1050Max
    iPhone 12 Pro Max 512Gb
    iPad 9th Gen iOS 15.6, 256GB

  • Stephen Chaffer
    Stephen Chaffer Member Posts: 75 ✭✭

    Dear Sir

    I'm new to preparing PPB, I would like more information about preparing the proper terms, have you further adice on the subject.

    Also, why does my Hebrew Text not appear in my commentary I'm making, there's space and if one clicks on it, it appears in a narrow box on the right?

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

    Stephen

  • steve clark
    steve clark Member Posts: 3,591 ✭✭✭

    Hi Stephen,

    i am not the one you were addressing, but this might possibly be helpful for you.

    I'm new to preparing PPB, I would like more information about preparing the proper terms, have you further adice on the subject.

    A. Read the Personal Book wiki page for details on using PBs.

    B. Get the PB macros for Word.

    C. If you don't understand a particular feature, then start a new post here on the forum and ask your question. Give as much details as possible so others can help.

     

    Also, why does my Hebrew Text not appear in my commentary I'm making

    You might start by copying Hebrew text from Logos4 and pasting it into your Word docx file. If you are familiar with typing Hebrew directly into Word, then make sure you are using the same font that is used in Logos4.
    [Below in the image you can see that my PB has Hebrew entered into it. Layered above my PB is Word where i show the font selection box that Word provides, relative to text that i have pasted from L4 into Word.]

    image

    (Click on the above picture to have your browser enlarge the picture)

     

    QLinks, Bibl2, LLR, Macros
    Dell Insp 17-5748, i5, 1.7 GHz, 8G RAM, win 8.1

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419


    (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

  • (1-9) /1 What's this really mean in plain English

    The search syntax:

    ([0-9]),([0-9])

    looks for one number [0-9] that is followed by a comma, which is followed by one number [0-9]

    Note: [0-9] looks for a range of characters from 0 through 9, which is equivalent to specifying all numeric digits [0123456789].

    The reference  /1 refers to what was found inside the first set of parenthesis while /2 refers to the second set of parenthesis so the chapter and verse numbers can be different.

    While formatting New Testament in a personal book Bible => American Standard Version 1901 - Personal Bible without Chapter and Verse #'s decided to add chapter milestones so wanted tag for the first verse in a chapter

    @{{bible-on}}[[@BibleKJV:Mt28:1]]

    to be preceded by a chapter milestone and a space:

    [[@BibleKJV:Mt28]] {{bible-on}}[[@BibleKJV:Mt28:1]]

    Should have used wildcard search string:

    (??bible-on[\}]{2})(??[\@]BibleKJV:[0-9,A-Z]{1,2}[a-z]{1,2}[0-9]{1,3})(:1)([\]]{2})

    with replacement

    \2\4 \1\2\3\4

    The second set of parenthesis (??[\@]BibleKJV:[0-9,A-Z]{1,2}[a-z]{1,2}[0-9]{1,3}) searches for:

    • ??  => two wildcard characters that can find [[ since Microsoft Word 2010 has a recursion limit for correctly parsing regular expressions with escaped characters (milestones are enclosed in brackets)
    • [\@]  => escaped syntax to search for @ special character (begins milestone tag)
    • BibleKJV:  => specific string of characters (Bible milestone using KJV versification)
    • [0-9,A-Z]{1,2} => one or two character(s): number OR capital letter (initial capital letter of Book plus a leading number)
    • [a-z]{1,2}  => one or two lower case letters (rest of Book abbreviation in lower case)
    • [0-9]{1,3}  => one, two, or three numbers (chapter number)


    The fourth set of parenthesis ([\]]{2}) searches for:

    • [\]]{2}  => escaped syntax to search for two ]] closing brackets (milestones are enclosed in brackets)

    The replacement string /2/4 /1/2/3/4 specifies that the second and fourth set of search results should be followed by a space then the original search results (copy the Bible milestone for verse 1 in a chapter to become the chapter milestone, which does not have a verse number).

    image


    For milestone tagging, personally used two or three character abbreviations for books with initial capital => http://www.logos.com/L4/support/biblebookabbrev

    Note: thread => American Standard Version 1901 - Personal Bible without Chapter and Verse #'s now has an updated New Testament file because my initial search string missed book abbreviations that began with a number.

    Keep Smiling [:)]

  • Stephen Chaffer
    Stephen Chaffer Member Posts: 75 ✭✭

    Hi 

    Thanks for your help, I knew these were possible but didn't know how it ticked.

    Also, your explanation is very helpful, and you've made it easy to follow

    Thanks again!

    Stephen

  • fgh
    fgh Member Posts: 8,948 ✭✭✭

    fgh said:

    Please don't call it "the European format". It's as foreign to me as it is to Americans, if not more.

    Didn't mean to offend.

    I know. I'm just a bit sensitive to Europe being treated as if it was one nation. It isn't. After all, we've spent most of history at each others' throats. There are vast cultural differences even between Sweden and Norway, or Sweden and Finland.

    It could be that it's something typical of the Romance Languages more than Europe per se

    My guess, from the languages you've mentioned and my own experience of which [British] English books I've found it in, would be that it's originally a Catholic thing. I don't think I've ever seen it in Swedish.

    If you know a quick way to do this please share.

    I use LibreOffice, not Word, and I do it so seldom that I have to look it up each time, so I'm afraid I can't. It's easy enough once you've got the strings right, though.

    something which the simple solution I proposed handles perfectly (as "complicated references" get a space after the comma when it is not a Scriptural citation)

    With "complicated" I was more referring to something like "8:4-6,11,14; 17; 21:12f,16; 23". Before you replace commas with colons you have to make sure that the book doesn't already use colons for something else, or you'll end up with a string where you can no longer figure out what's supposed to be a verse and what's supposed to be a chapter.

     

    Mac Pro (late 2013) OS 12.6.2

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    fgh said:

    My guess, from the languages you've mentioned and my own experience of which [British] English books I've found it in, would be that it's originally a Catholic thing. I don't think I've ever seen it in Swedish.

    I've also seen in an article or two the comma format referred to as typical in Catholic writings. Interestingly, the (Catholic) New American Bible notes in English use the comma system, I believe, another indication along those lines.

    fgh said:

    With "complicated" I was more referring to something like "8:4-6,11,14; 17; 21:12f,16; 23". Before you replace commas with colons you have to make sure that the book doesn't already use colons for something else, or you'll end up with a string where you can no longer figure out what's supposed to be a verse and what's supposed to be a chapter.

    Good point. If the author does not put a space after the comma when doing citations like 8:4-6,11,14 then that would in fact cause problems. If he puts a space after the comma in those cases it would work correctly.

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    " rel="nofollow">Keep Smiling 4 Jesus :) said:

    Should have used wildcard search string:

    (??bible-on[\}]{2})(??[\@]BibleKJV:[0-9,A-Z]{1,2}[a-z]{1,2}[0-9]{1,3})(:1)([\]]{2})

    with replacement

    \2\4 \1\2\3\4

    Now that, my friends, is a search and replace string! Thanks for sharing KS4J!

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    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.

    Have you actually done this Fr Devin Roza? If so, Could you please post a screen shot of the find and replace window as you did for the above example?

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    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.

    Have you actually done this Fr Devin Roza? If so, Could you please post a screen shot of the find and replace window as you did for the above example?

    I hadn't done it, but I did right now. Here are some test files, and the search. In the test file, the headwords we want to mark up are using Heading 1, which is what I will be replacing with the text Logos/Verbum needs to tell it this is an Encyclopedia headword. When you import the book, be sure to classify it as an encyclopedia.

    Original Dictionary file: 5822.Test.docx

    Dictionary file ready for Logos/Verbum: 6036.TestResult.docx

    Here is the search you need to run to get from the original to the final file. Just click Replace All, and it will do all of them at once:

    A few notes about this search:

    - The search is for text that is Heading 1, any number of characters or words long, until it hits a carriage return (^13).

    - The replace text uses \1 to indicate the variable (everything in between the () in the search string). Note that the replace string uses ^p instead of ^13. This is important, as ^13 does not work correctly in the replace string to indicate a carriage return (^13 doesn't work properly with styles in the replace box). 

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    Thank you so much for taking the time to share this! This is a game changer. I have many old dictionaries, encyclopedias that will now have headword milestones :-) You are a blessing

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    Just did an encyclopedia, 540 Headwords coded in 1 sec. I'm suffering from perma-grin right now [:D]

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    Just did an encyclopedia, 540 Headwords coded in 1 sec. I'm suffering from perma-grin right now Big Smile

    Glad it worked!! [:D]

  • Liam
    Liam Member Posts: 1,439 ✭✭✭

    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.

    Have you actually done this Fr Devin Roza? If so, Could you please post a screen shot of the find and replace window as you did for the above example?

    I hadn't done it, but I did right now. Here are some test files, and the search. In the test file, the headwords we want to mark up are using Heading 1, which is what I will be replacing with the text Logos/Verbum needs to tell it this is an Encyclopedia headword. When you import the book, be sure to classify it as an encyclopedia.

    Original Dictionary file: 5822.Test.docx

    Dictionary file ready for Logos/Verbum: 6036.TestResult.docx

    Here is the search you need to run to get from the original to the final file. Just click Replace All, and it will do all of them at once:

    A few notes about this search:

    - The search is for text that is Heading 1, any number of characters or words long, until it hits a carriage return (^13).

    - The replace text uses \1 to indicate the variable (everything in between the () in the search string). Note that the replace string uses ^p instead of ^13. This is important, as ^13 does not work correctly in the replace string to indicate a carriage return (^13 doesn't work properly with styles in the replace box). 

    Wow! That's great to know!
  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    Glad it worked!!

    follow up question...

    What would be the best procedure for the following scenario? When a book is set up with the bolded term in the beginnning of the sentence(paragraph) but it's not on a separate line. Using the normal find/replace wildcard syntax above doesn't work because there is no new paragraph following each term. Instead the term just runs into the sentence defining it. Is there a way to tell Word that after a certain font style to cause there to be a new paragraph? If there was I think your previous find/replace syntax for headwords would work.

    For example, I need a way to automatically change every instance of this type of formatting...

    to this type (which will work with you find/replace syntax)

    I've searched all over online but apparently my Word terminology isn't right because I'm not seeing anything. I know it's got to be simple to add a new paragraph after a font style automatically

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    Glad it worked!!

    follow up question...

    What would be the best procedure for the following scenario? When a book is set up with the bolded term in the beginnning of the sentence(paragraph) but it's not on a separate line. Using the normal find/replace wildcard syntax above doesn't work because there is no new paragraph following each term. Instead the term just runs into the sentence defining it. Is there a way to tell Word that after a certain font style to cause there to be a new paragraph? If there was I think your previous find/replace syntax for headwords would work.

    Yes, that's very possible to do. When you put your cursor in the "Find what" box, and then select the "Special" button, notice that the < indicates the beginning of a word, and > the end of a word. Then, using the "Format" button on the bottom left, you set your format to bold (note there are two places to set it - usually the first one works best for me).

    So, to find a single word in Bold, and replace it with that same word in Bold plus Enter, you would replace for:

    But a search like this by itself will almost certainly give you problems. The reason is you'll probably have Titles that have more than one word.

    So, in these cases what I would do is start with the highest number of words, and work your way down. And, when you replace your text, replace it and change the format to something that's not bold, say Heading 2 or something not used elsewhere in the document, again setting this value using the Format button while your cursor is in the "Replace with" box. That way your subsequent search and replaces won't find it. At the end of the process, you can always change all of them back if you like. 

    To search for two words in bold, it would be (<*>) (<*>)

    Notice the space between the words. Then the replace string would be \1 \2^p

    But start with 3 or 4 words, or however many would be the most. Then one less, and so on, all the way down to 1. 

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    Thank you for your thorough response and illustration. I'll give it a test drive :-)

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    My pleasure. Hope it works out for you.

    Actually, now that I think of it, for two words, instead of (<*>) (<*>), it would be better to search for (<*> <*>). And so on for more words, or patterns - always in a single ().

    That way you could always just leave the "Replace with" field the same. It would always just be \1^p

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    a search like this by itself will almost certainly give you problems.

    Ok, this has got me most of the way there. The only thing lacking is a way to specify to only find the bold words which are at the start of a paragraph which I'd assume is noted by a paragraph marker, because often there are other bolded words in the definitions which I don't want to replace with a new paragraph

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • Fr Devin Roza
    Fr Devin Roza MVP Posts: 2,419

    a search like this by itself will almost certainly give you problems.

    Ok, this has got me most of the way there. The only thing lacking is a way to specify to only find the bold words which are at the start of a paragraph which I'd assume is noted by a paragraph marker, because often there are other bolded words in the definitions which I don't want to replace with a new paragraph

    Yeah, these can get tricky... the problem there is that the carriage return isn't bold, and when you search for a specific format, everything you find has to have that format. 

    So, you need to fix that problem first. That is, you need to make every carriage return in the document bold!!

    So, search for (^13) and replace it with \1 in bold.

    Then, you can search for (^13<*>) in bold. But starting with whatever patterns are your longest as described above (e.g. (^13<*> <*> <*>) for three words.

    Finally, you can search for (^13) and replace it with \1 but specifying that the format should be regular, to return your carriage returns to the way they were before. 

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    search for (^13) and replace it with \1 in bold.

    Then, you can search for (^13<*>) in bold. But starting with whatever patterns are your longest as described above (e.g. (^13<*> <*> <*>) for three words.

    Finally, you can search for (^13) and replace it with \1 but specifying that the format should be regular, to return your carriage returns to the way they were before.

    That did it!!!

    I'm suffering from perma-grin right now... Big Smile AGAIN!

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • John Brumett
    John Brumett Member Posts: 612 ✭✭

    Okay so I need the find and replace for all scripture references.

    Examples:

    John 3:16               [[@Bible: John 3:16]]

    Numbers 21:33-35  [[@Bible: Numbers 21:33-35]]

  • Bernhard
    Bernhard Member Posts: 718 ✭✭✭

    That would mean to write quite an extensive macro to do it. But aren't those references recognized automatically without tagging in your personal book?

  • James Taylor
    James Taylor Member Posts: 1,408 ✭✭✭

    The goal is first to get the references to a line by themselves and then assign them to a heading style. Then the above procedure will work. I've gotten pretty creative with this process to make it happen.. for instance, often you will find (3:17) which has to be told to find ( and replace with John and force a new paragraph at a certain heading style, then remove ) at that heading style.  so you end up with John 3:17 at whichever heading style, on a line by itself.

    Logos 10  | Dell Inspiron 7373 | Windows 11 Pro 64, i7, 16GB, SSD | iPhone 13 Pro Max

  • Okay so I need the find and replace for all scripture references.

    Examples:

    John 3:16               [[@Bible: John 3:16]]

    Numbers 21:33-35  [[@Bible: Numbers 21:33-35]]

    Find What ([12 Songf]{2,8}[A-Z][a-z]{1,12}[ ][0-9]{1,3}[:][0-9\-]{1,7})

    matches:

    1 John 1:6-10

    1 Corinthians 13:13

    Song of Solomon 1:4

    Find What ([A-Z][a-z]{1,12}[ ][0-9]{1,3}[:][0-9\-]{1,7})

    matches:

    John 3:16

    Numbers 21:33-35

    Psalms 119:169-176

    Replace with [[@Bible: \1]]

    Notice "Find Next" highlighted John 1:6-10 so prudent to verify Find highlights all of desired text to change before replacing.

    Jude is one of the Bible Books that does not have a chapter number so searching for colon separator does not find Book verse(s).

    Word wildcard matching FAQ => http://word.mvps.org/FAQs/General/UsingWildcards.htm

    Be cautious with using * in wildcard search since * can match lots of characters.

    Keep Smiling [:)]

  • John Brumett
    John Brumett Member Posts: 612 ✭✭

    Question for anyone or Keep Smiling for Jesus:

    How do I run the prior Find and Replace if I want to keep the Scripture References but duplicate the milestones

    For example  

    Matthew 2:19-23; Luke  2:1-20, 39; John  2:1-11; 2 Peter 1:16-18   

    I want to end up with

    Matthew 2:19-23 [[@Bible Matthew 2:19-23]]; Luke  2:1-20, 39 [[@Bible Luke 2:1-20, 29]]; John  2:1-11 [[@BibleJohn 2:1-11]]; 2 Peter 1:16-18 [[@Bible 2 Peter 1:16-18]] 

  • Personal Book (PB) text Matthew 2:19-23 would have the last preceding Bible milestone as location. Text Luke 2:1-20 , 29 would have Bible milestone of Matthew 2:19-23 so suggest placing @Bible milestone before verse reference.

    Bible milestone cannot skip verses: e.g. [[@BibleLuke 2:1-2029]] in Logos 7.3 Beta 1 receives PB compilation message

    [Warning] Unrecognized milestone Bible Luke 2:1-20, 29

    Screen shot of Word 2010 document showing Find Next highlighted that does not have the 2 of 2 Peter

    Microsoft implemented a subset of regular expression pattern in Word: e.g. every search term has to occur once so different Find is needed for Bible Books that have a numeric prefix. Also Find expression can receive error about being too complex

    ([12][ ][A-Z][a-z]{1,12})([ ]{1,2})([0-9]{1,3}[:][0-9\-]{1,7})

    Find What 

    ([12 ]{2}[A-Z][a-z]{1,12})([ ]{1,2})([0-9]{1,3}[:][0-9\-]{1,7})

    matches

    2 Peter 1:16-18

    Wildcard Find explanation

    • [12 ]{2} looks for two occurrences of three characters
    • [A-Z][a-z]{1,12} looks for 1 to 12 occurrences of Alphabetic characters
    • [ ]{1,2} looks for one or two spaces (example had two spaces after Luke and John)
    • [0-9]{1,3} looks for one to three numbers
    • [:] looks for colon (separator between chapter and verse
    • [0-9\-]{1,7} looks for one to seven Numbers OR dash

    Bible reference Psalms 119:169-176 has chapter with three numbers and verses with three numbers.

    Parenthesis group wildcard find results for replacement

    • Result \1 => "2 Peter"
    • Result \2 => " "
    • Result \3 => "1:16-18"

    so Replace With

    [[@Bible \1 \3]]\1 \3

    uses first and third string result (so one or two spaces between book name and chapter is replaced with one space)

    [[@Bible 2 Peter 1:16-18]]2 Peter 1:16-18

    Find What

    ([A-Z][a-z]{1,12})([ ]{1,2})([0-9]{1,3}[:][0-9\-]{1,7})

    Matthew 2:19-23

    Luke  2:1-20

    John  2:1-11

    Peter 1:16-18   

    Replace with

    [[@Bible \1 \3]]\1 \3

    OR

    [[@Bible: \1 \3]]\1 \3

    Colon after @Bible is optional.

    @Bible milestones using book abbreviations:

    [[@Bible:Mt2.19-23]]Matthew 2:19-23; [[@Bible:Lk2.1-20]]Luke  2:1-20, 39; [[@Bible:Jn2.1-11]]John  2:1-11; [[@Bible:2P1.16-18]]2 Peter 1:16-18

    Logos Help has complete list of Bible Book abbreviations.

    Keep Smiling [:)]

  • Jean Gilbert
    Jean Gilbert Member Posts: 5 ✭✭

    Hi, I am looking for a find and replace that can take a verse range like 6:1-12 to [[@Bible:Genesis 6:1-12]]. Can anyone help me please? I will appreciate it greatly. Thanks.

  • David Goodman
    David Goodman Member Posts: 65 ✭✭

    Thanks, John, for laboriously spelling it out for someone like me to understand. I really appreciate it.

  • Hi, I am looking for a find and replace that can take a verse range like 6:1-12 to [[@Bible:Genesis 6:1-12]]. Can anyone help me please? I will appreciate it greatly. Thanks.

    Welcome to the Logos Bible Software forums [:D]

    Earlier reply in this thread => https://community.logos.com/forums/p/51122/867292.aspx#867292 has find and replace for conversion of Genesis 6:1-12 to [[@Bible:Genesis 6:1-12]]

    Find What

    ([A-Z][a-z]{1,12})([ ]{1,2})([0-9]{1,3}[:][0-9\-]{1,7})

    Genesis 6:1-12

    Replace with

    [[@Bible \1 \3]]\1 \3

    OR

    [[@Bible: \1 \3]]\1 \3

    For verses without Bible Book, can Find references that have a colon ":" between chapter and verse range

    ([ ]{1,2})([0-9]{1,3}[:][0-9\-]{1,7})

    Replace with (includes Bible Book)

    [[@Bible Genesis \2]]Genesis \2

    OR

    [[@Bible:Genesis \2]]Genesis \2

    Keep Smiling [:)]

  • Jean Gilbert
    Jean Gilbert Member Posts: 5 ✭✭

    Thank you so much for all your help. I got it now. God bless you.

  • Thiago Samico
    Thiago Samico Member Posts: 73 ✭✭

    I am now getting used to Wildcards. Thanks to this post!

    Finding is not the problem at all, but I noticed that I am surely misunderstanding something in the "replace" part. 

    I have a Personal Bible that is formatted like:

    [[@Bible:Ge 1:7]]7. {{field-on:bible}}E assim aconteceu. Deus criou um espaço para separar as águas da terra das águas dos céus.{{field-off:bible}}

    It shows "7." before the verse text. 

    What I am trying to achieve is to replace that with 1:7 (this is a link) before the verse text. 

    So, the idea is to replace "7." with "[[1.7>>Bible: Ge 1:7]]

    I am using the following to find the string:

    (??[\@]Bible:)([A-Z][a-z]@&gt;)( )([0-9]@&gt;)(:)([0-9]@&gt;)([\]]{2})([0-9]@&gt;.)

    The string used for replace is:

    \1\2\3\4\5\6\7 [[\4:\6>>Bible: \2 \4\5\6]]

    The problem is that the result is:

    [[@Bible:Ge 1:7]] [[1:7>>Bible: Ge \4\5\6]] {{field-on:bible}}E assim aconteceu. Deus criou um espaço para separar as águas da terra das águas dos céus.{{field-off:bible}}

    I am certainly misusing the \4\5\6 part because it seems word stops recognizing them as representatives of the ( ) parts. 

    Please help me understand and solve that! 

    Thank you!