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

Re: [Clip] Find and Replace via Clipbook

Expand Messages
  • Axel Berger
    ... Yes mine. Only, it replaces the umlauts correctly to ISO 8859-1 or ANSI ... ^!Find [ xC0- xF7][ x80- xBF]* RS ^!IfError donelatin ^!IfMatch
    Message 1 of 6 , Feb 2, 2012
      Thomas Mergen wrote:
      > Is there an Clipbook-Code to find and replace this letters?

      Yes mine. Only, it replaces the umlauts correctly to ISO 8859-1 or ANSI
      and not to your transcriptions:

      -------------------------------------------------
      :loop
      ^!Find "[\xC0-\xF7][\x80-\xBF]*" RS
      ^!IfError donelatin
      ^!IfMatch "[\xC2-\xC3][\x80-\xBF]" "^$GetSelection$" latin1
      ^!IfMatch "[\xC0-\xDF][\x80-\xBF]" "^$GetSelection$" zwei
      ^!IfMatch "[\xE0-\xEF][\x80-\xBF]{2}" "^$GetSelection$" drei
      ^!IfMatch "[\xF0-\xF7][\x80-\xBF]{3}" "^$GetSelection$" vier
      ^!Continue Illegal sequence, can't be converted.
      ^!Goto loop
      :zwei
      ^!Set %first%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";2)$)$ MOD
      64)$
      ^!Set %second%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";1)$)$ MOD
      32)$
      ^!Set %third%=0
      ^!Set %fourth%=0
      ^!Goto makeent
      :drei
      ^!Set %first%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";3)$)$ MOD
      64)$
      ^!Set %second%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";2)$)$ MOD
      64)$
      ^!Set %third%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";1)$)$ MOD
      16)$
      ^!Set %fourth%=0
      ^!Goto makeent
      :vier
      ^!Set %first%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";4)$)$ MOD
      64)$
      ^!Set %second%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";3)$)$ MOD
      64)$
      ^!Set %third%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";2)$)$ MOD
      64)$
      ^!Set %fourth%=^$Calc(^$CharToDec(^$StrIndex("^$GetSelection$";1)$)$ MOD
      8)$
      :makeent
      ^!Set
      %first%=^$Calc(262144*^%fourth%+4096*^%third%+64*^%second%+^%first%;0)$
      ^!InsertText &#^%first%;
      ^!Goto loop
      :latin1
      ^!Set %first%=^$StrCopyRight("^$GetSelection$";1)$
      ^!Set %second%=^$StrCopyLeft("^$GetSelection$";1)$
      ^!Set %first%=^$Calc(^$CharToDec(^%first%)$ MOD 64)$
      ^!Set %second%=^$Calc(^$CharToDec(^%second%)$ MOD 4)$
      ^!InsertText ^$DecToChar(^$Calc(64*^%second%+^%first%)$)$
      ^!Goto loop
      :donelatin
      ^!Replace "€" >> "€" WASTI
      ^!Replace "Š" >> "Š" WASTI
      ^!Replace "š" >> "š" WASTI
      ^!Replace "Ž" >> "Ž" WASTI
      ^!Replace "ž" >> "ž" WASTI
      ^!Replace "Œ" >> "Œ" WASTI
      ^!Replace "œ" >> "œ" WASTI
      ^!Replace "Ÿ" >> "Ÿ" WASTI
      -------------------------------------------------

      It first transforms everthing possible from UTF-8 to latin-1, then
      writes all others, those that don't fit into the 8-bit character set, as
      HTML entities, and lastly makes the 8 changes to go from latin-1 to
      cp-1252 aka Windows.

      Axel

      --
      Dipl.-Ing. F. Axel Berger Tel: +49/ 2174/ 7439 07
      Johann-Häck-Str. 14 Fax: +49/ 2174/ 7439 68
      D-51519 Odenthal-Heide eMail: Axel-Berger@...
      Deutschland (Germany) http://berger-odenthal.de
    • Axel Berger
      ... That won t work. Regex xC3 xA4 would. Axel
      Message 2 of 6 , Feb 2, 2012
        John Shotsky wrote:
        > ^!Replace "ä" >> "ae" AHST

        That won't work. Regex \xC3\xA4 would.

        Axel
      • John Shotsky
        Right, I get those when converting html, and forgot that NT won t recognize them natively. My clips actually include all the forms that might be found in a
        Message 3 of 6 , Feb 2, 2012
          Right, I get those when converting html, and forgot that NT won't recognize them natively. My clips actually include all
          the forms that might be found in a text file, so my whole clip would work, while my example wouldn't.

          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 Axel Berger
          Sent: Thursday, February 02, 2012 11:09
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] Find and Replace via Clipbook


          John Shotsky wrote:
          > ^!Replace "ä" >> "ae" AHST

          That won't work. Regex \xC3\xA4 would.

          Axel



          [Non-text portions of this message have been removed]
        • Thomas Mergen
          Hi John, sorry, am not a experienced user. Can short show how I can use Regex xC3 xA4 in a clip to transform ä into ae? Thank you for your efforts. Tom
          Message 4 of 6 , Feb 3, 2012
            Hi John,

            sorry, am not a experienced user. Can short show how I can use "Regex \xC3\xA4" in a clip to transform ä into ae?

            Thank you for your efforts.
            Tom

            --- In ntb-clips@yahoogroups.com, "John Shotsky" <jshotsky@...> wrote:
            >
            > Right, I get those when converting html, and forgot that NT won't recognize them natively. My clips actually include all
            > the forms that might be found in a text file, so my whole clip would work, while my example wouldn't.
            >
            > 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 Axel Berger
            > Sent: Thursday, February 02, 2012 11:09
            > To: ntb-clips@yahoogroups.com
            > Subject: Re: [Clip] Find and Replace via Clipbook
            >
            >
            > John Shotsky wrote:
            > > ^!Replace "ä" >> "ae" AHST
            >
            > That won't work. Regex \xC3\xA4 would.
            >
            > Axel
            >
            >
            >
            > [Non-text portions of this message have been removed]
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.