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

23895Re: alphanumeric character transcoding, by ones and pairs

Expand Messages
  • flo.gehrke
    Jun 21, 2013
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "rickah" <richolland@...> wrote:
      > Yes, you are again correct. I did make those changes but failed
      > to note them all here. This is my LIST.TXT as it stands now
      > --
      > LIST.TXT
      > a»g
      > A»h
      > (...)


      Two more ideas:

      1. If in LIST.TXT the '»' is OK for you as a separator then we don't have to replace the pipe in that list any more but only the CRNL.

      2. Your new LIST.TXT is containing...


      Please note that the dot is a RegEx metacharacter which means 'any character except NL'. As a literal character it must be escaped with '\.' on the left:


      If you like we could omit the escaping in the list and insert two command lines which will automatically check any search character and add the backslash if needed -- see below.

      If you prefer this solution then remove all backslashs on the left in LIST.TXT.

      Regarding these ideas, now the latest version could be...

      ^!SetHintInfo Working...
      ^!SetScreenUpdate Off
      ^!SetClipboard ^$GetFileText(^$GetDocumentPath$LIST.TXT)$
      ^!SetClipboard ^$StrReplace(\R;»;^$GetClipboard$;RA)$
      ^!SetListDelimiter »
      ^!SetArray %Char%=^$GetClipboard$
      ^!Set %i%=0

      ^!Inc %i%
      ^!If ^%i% > ^%Char0% Out
      ^!Set %Search%=^%Char^%i%%
      ; New: Check for metacharacters
      ; --- Long line start---
      ^!IfMatch "(\.|\[|\(|\)|\^|\$|\*|\+|\?|\\|{|\|)" "^%Search%" Next Else Skip
      ; --- Long line end ---
      ^!Set %Search%=\^%Search%
      ^!Inc %i%
      ^!Set %RepWith%=^%Char^%i%%
      ^!Replace "(?<!\|)^%Search%" >> "|^%RepWith%" WARS
      ^!Goto Loop

      ^!Replace "|" >> "" WATS
      ^!Info Finished!

    • Show all 19 messages in this topic