Power Tip: Using variables to Search and Replace in Word

Page 3 of 3 (45 items) < Previous 1 2 3
This post has 44 Replies | 5 Followers

Posts 15805
Forum MVP
Keep Smiling 4 Jesus :) | Forum Activity | Replied: Sun, Nov 27 2016 12:35 PM

John Brumett:

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 [[@Bible John 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. [[@Bible Luke 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.

John Brumett:

@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 Smile

Posts 3
Jean Gilbert | Forum Activity | Replied: Thu, Mar 23 2017 7:07 AM

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.

Posts 51
David Goodman | Forum Activity | Replied: Thu, Mar 23 2017 1:23 PM

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

Posts 15805
Forum MVP
Keep Smiling 4 Jesus :) | Forum Activity | Replied: Thu, Mar 23 2017 4:10 PM

Jean Gilbert:

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 Big Smile

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 Smile

Posts 3
Jean Gilbert | Forum Activity | Replied: Fri, Mar 24 2017 5:44 AM

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

Page 3 of 3 (45 items) < Previous 1 2 3 | RSS