Loading ...
Sorry, an error occurred while loading the content.

23549[Clip] Re: Tooltip clip?

Expand Messages
  • m.feichtinger
    Dec 19, 2012
    • 0 Attachment
      Hi,

      I took John's suggestion and modified his code. The following clip works on your provided test text.
      The (?#...) groups are comments for better readability, you can remove them.
      The (?<Name>...) groups are named for convenient reference.
      The RegEx containing the book list is taken from "Help > Help on Regular Expression > Named Subpatterns".

      HTH

      ;===
      ; Replace 2nd and any other Matt. with Mat_
      ;^!Replace "^Matt \d+:\d+.+Mat\Kt\. " >> "_" RWAS
      ; Expand the following book list incl. short names to your liking.
      ; --- LONG LINE START
      ^!Replace "(?xJ)^(?<HEAD>Matt\x20\d++:\d++\.?) (?<TEXT>.+) \K ((?#BooklistStart) (?<SN>Mat)(?:t)? | (?<SN>Mar)(?:k)? | (?<SN>Luu)(?:k)? | (?<SN>Joh)(?:)? | (?<SN>Esr)(?:a)? | (?<SN>Mii)(?:ka)? | (?<SN>Ruu)(?:t)? (?#BooklistEnd)) \.? \x20" >> "$<SN>_" RWAS
      ; --- LONG LINE END
      ^!IfError Next Else Skip_-1
      ;^!Continue Continue?

      ; Add Mat_ to any number/colon series missing it.
      ;^!Replace "^.+(Mat_)(\d+:\d+)(.+)\K (?=\d+:\d+)" >> " $1" RWAS
      ; Add any short name (Xxx_ = uppercase letter, followed by 2 lowercase letters, followed by an underscore) to any number/colon series missing it.
      ; --- LONG LINE START
      ^!Replace "(?x)^(?<TEXT>.+) (?<SN>\p{Lu}\p{Ll}{2}_) (\d+:\d+) (.+) \K \x20 (?=\d+:\d+)" >> " $<SN>" RWAS
      ; --- LONG LINE END
      ^!IfError Next Else Skip_-1
      ;^!Continue Continue?
      ;===

      ; Change format "Xxx_15:7,38" (comma not surrounded by spaces!) to "Xxx_15:7, Xxx_15:38":
      ; --- LONG LINE START
      ^!Replace "(?x)^(?<TEXT>.+) ( (?<SN>\p{Lu}\p{Ll}{2}_)(?<CHAP>\d++:)\d++ ) , (?<VERS2>\d++)" >> "$<TEXT>$2, $<SN>$<CHAP>$<VERS2>" RWAS
      ; --- LONG LINE END
      ^!IfError Next Else Skip_-1


      --- In ntb-clips@yahoogroups.com, T L <puusto13@...> wrote:
      >
      > It works with Matt rather good but there is some bugs like Matt 1:5. Salmonille Booas, jonka äiti oli Raahab. Booakselle syntyi
      > Oobed, jonka äiti oli Ruut. Oobedille syntyi Iisai Mat_4:13,17...Here?
      > Matt 4:15. Elihudille Eleasar, Eleasarille Mattan, Mattanille Jaakob.(Mat_15:7,38; Here?
      >
      > But how can I got it work with all the Bible books?
      > (1. Moos.|2. Moos.|3. Moos.|4. Moos.|5. Moos.|Joos.|Tuom.|Ruut|1. Sam.|2. Sam.|1. Kun.|2. Kun.|1. Aik.|2. Aik.|Esra|Neh.|Est.|Job|Ps.|Sananl.|Saarn.|Laul. l.|Jes.|Jer.|Valit.|Hes.|Dan.|Hoos.|Joel|Aam.|Ob.|Joona|Miika|Nah.|Hab.|Sef.|Hagg.|Sak.|Mal.|Matt|Mark|Luuk|Joh.|Ap. t.|Room.|1. Kor.|2. Kor.|Gal.|Ef.|Fil.|Kol.|1. Tess.|2. Tess.|1. Tim.|2. Tim.|Tit.|Filem.|Hepr.|Jaak.|1. Piet.|2. Piet.|1. Joh.|2. Joh.|3. Joh.|Juud.|Ilm.)
      >
      > TL
      >
      >
      >
      > ________________________________
      > From: John Shotsky <jshotsky@...>
      > To: ntb-clips@yahoogroups.com
      > Sent: Wednesday, December 19, 2012 12:27 AM
      > Subject: RE: [Clip] Re: Tooltip clip?
      >
      >
      >  
      > If I have understood the requirement this time, and if the first word is actually 'Matt' and not 'Mat', then the following will capture each of the Matt bits correctly.
      > For other words, just repeat these 4 lines with the new words inserted where Matt or Mat is now. If any periods are in doubt, place a question mark after them.
      > ;===
      > ;Replace 2nd and any other Matt. with Mat_
      > ^!Replace "^Matt \d+:\d+.+Mat\Kt\. " >> "_" ARSW
      > ^!IfError Next Else Skip_-1
      > ;Add Mat_ to any number/colon series missing it.
      > ^!Replace "^.+(Mat_)(\d+:\d+)(.+)\K (?=\d+:\d+)" >> " $1" ARSW
      > ^!IfError Next Else Skip_-1
      > ;===
      >
      > Results with test text:
      > Matt 1:1. Luku 1 JEESUKSEN SYNTYMÄ JA LAPSUUS Jeesuksen sukuluettelo (Mat_3:23-38). Jeesuksen Kristuksen, Daavidin pojan, Abrahamin pojan, sukuluettelo: Mat_132:11; Mat_1:3; Mat_3:16; Mat_22:16-17. (Mat_15:7,38, Mat_27:9, Mat_28:27
      > Matt 1:2. Abrahamille syntyi Iisak, Iisakille Jaakob, Jaakobille Juuda ja tämän veljet. Mat_21:3, Mat_29:35
      > Matt 1:3. Juudalle syntyivät Peres ja Serah, joiden äiti oli Taamar. Perekselle syntyi Hesron, Hesronille Raam, Mat_38:27-30; Mat_4:18-22; Mat_2:4-15
      > Matt 1:4. Raamille Amminadab, Amminadabille Nahson, Nahsonille Salmon,
      > Matt 1:5. Salmonille Booas, jonka äiti oli Raahab. Booakselle syntyi Oobed, jonka äiti oli Ruut. Oobedille syntyi Iisai Mat_4:13,17
      > Matt 1:6. ja Iisaille Daavid, kuningas. Daavidille syntyi Salomo, jonka äiti oli Uurian vaimo. Mat_12:10,24
      > Matt 1:7. Salomolle syntyi Rehabeam, Rehabeamille Abia, Abialle Aasa, Mat_11:43, Mat_14:31, Mat_15:8
      > Matt 1:8. Aasalle Joosafat, Joosafatille Jooram, Jooramille Ussia, Mat_15:24; Mat_8:16; Mat_26:1.
      > Matt 1:9. Ussialle Jootam, Jootamille Aahas, Aahakselle Hiskia, Mat_15:7,38; Mat_27:9, Mat_28:27
      > Matt 1:10. Hiskialle Manasse, Manasselle Aamon, Aamonille Joosia Mat_20:21, Mat_21:18; Mat_32:33, Mat_33:25: Salmonille Booas, jonka äiti oli Raahab. Booakselle syntyi Oobed, Mat_23:34, Mat_3:15,16; Mat_36:1,8;
      > Matt 1:11. ja Joosialle Jekonja ja tämän veljet siihen aikaan, kun kansaa siirrettiin Babyloniaan. Mat_23:34, Mat_3:15,16; Mat_36:1,8; Salomolle syntyi Rehabeam, Rehabeamille Abia, Abialle Aasa, Mat_11:43, Mat_14:31, Mat_15:8
      > Matt 1:12. Babyloniaan siirtämisen jälkeen Jekonjalle syntyi Sealtiel, Sealtielille Serubbaabel, Mat_3:17,19; Mat_3:2
      > Matt 2:13. Serubbaabelille Abihud, Abihudille Eljakim, Eljakimille Assur, (Mat_15:7,38, Mat_27:9, Mat_28:27).
      > Matt 3:14. Assurille Saadok, Saadokille Jaakin, Jaakinille Elihud, (Mat_15:7,38; Mat_27:9; Mat_28:27)
      > Matt 4:15. Elihudille Eleasar, Eleasarille Mattan, Mattanille Jaakob.(Mat_15:7,38; Mat_27:9, Mat_28:27),
      > Matt 5:16. ja Jaakobille Joosef, Marian mies. Mariasta syntyi Jeesus, jota kutsutaan Kristukseksi1.
      > Matt 6:17. Abrahamista Daavidiin on siten kaikkiaan neljätoista sukupolvea, Daavidista Babylonian pakkosiirtolaisuuteen asti neljätoista ja Babylonian pakkosiirtolaisuudesta Kristukseen neljätoista sukupolvea. Jeesuksen syntymä (Mat_2:1-7).
      >
      > Regards,
      > John
      > RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      >
      > From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of T L
      > Sent: Tuesday, December 18, 2012 13:54
      > To: ntb-clips@yahoogroups.com
      > Subject: Re: [Clip] Re: Tooltip clip?
      >
      >
      > Hi,
      >
      > Thanks.
      > When the first 'Matt' starts, at the beginning of the line, it is not change wanted there.
      > Every line begin with the book abr name like Matt, Mark, Luuk and so on.
      >
      > Here is the rightscripture example:
      >
      > Matt 1:1. Luku 1 JEESUKSEN SYNTYMÄ JA LAPSUUS Jeesuksen sukuluettelo (Matt. 3:23â€"38). Jeesuksen Kristuksen, Daavidin pojan, Abrahamin pojan, sukuluettelo: Matt. 132:11; Matt. 1:3; 3:16; Matt. 22:16-17. (Matt. 15:7,38, 27:9, 28:27
      > Matt 1:2. Abrahamille syntyi Iisak, Iisakille Jaakob, Jaakobille Juuda ja tämän veljet. Matt. 21:3, 29:35.
      >
      > I got this result with NoteTab Pro 6.2:
      >
      > dot:Matt 1:1. Luku 1 JEESUKSEN SYNTYMÄ JA LAPSUUS Jeesuksen sukuluettelo (Mat_3:23â€"38).dot: Jeesuksen Kristuksen, Daavidin pojan, Abrahamin pojan, sukuluettelo: Mat_132:11; Mat_Matt.dot: 1:3; 3:16; Mat_22:16-17.dot: (Mat_15:7,38, Mat_27:9, Mat_28:27
      > Matt Mat_1:2.dot: Abrahamille syntyi Iisak, Iisakille Jaakob, Jaakobille Juuda ja tämän veljet. Mat_21:3, Mat_29:35.dot:
      >
      > TL
      >
      > ________________________________
      > From: m.feichtinger <mafei@... <mailto:mafei%40gmx.at> >
      > To: ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>
      > Sent: Tuesday, December 18, 2012 7:49 PM
      > Subject: [Clip] Re: Tooltip clip?
      >
      > --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , "puusto13" wrote:
      >
      > Matt. 10:2; 21:3, 29:35. Matt. 10:2, 21:3; 29:35.
      > ...
      > Result must be:
      > Mat_10:2; Mat_21:3, Mat_29:35. Mat_10:2, Mat_21:3; Mat_29:35.
      > and it must work with other bible books names example Mark to Rev!?
      >
      > TL
      >
      > Try this one, it works with NoteTab Pro 6.2:
      >
      > ;^!SetDebug ON
      > :LoopStart
      > ; Find bookname, followed by a dot, followed by any character up to the next dot:
      > ^!Find "(?xs)\b(Matt|Mark|Luk|Joh|Gen)\. .+? \." rwsi
      > ; Not found? End loop:
      > ^!IfError LoopEnd
      > ; Store found selection in variable:
      > ^!Set %S%=^$GetSelection$
      > ; Remove spaces following double colons:
      > ^!Set %S%=^$StrReplace(": ";":";^%S%;n;n)$
      > ; Store the first 3 chars as new bookname:
      > ^!Set %Bookname%=^$StrCopy(^%S%;1;3)$
      > ; Remove old bookname (all chars from pos1 to dot incl.):
      > ^!Set %S%=^$StrDeleteLeft(^%S%;^$StrPos(".";^%S%;n)$)$
      > ; Insert new bookname and underscore:
      > ^!Set %S%=^$StrReplace(^%SPACE%;"^%SPACE%^%Bookname%_";^%S%;n;n)$
      > ; Remove leading and trailing whitespace:
      > ^!Set %S%=^$StrTrim(^%S%)$
      > ;^!Info "^%S%"
      > ; The found string is still selected,
      > ; replace it with the new formatted string:
      > ^!InsertText ^%S%
      >
      > ^!Skip Done?
      > ^!Goto LoopStart
      >
      > :LoopEnd
      > ^!SetDebug OFF
      >
      > HTH
    • Show all 27 messages in this topic