Community
    • 登入

    How do I create character blocks of specified length?

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    4 貼文 3 Posters 2.8k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Andrew ScharbarthA
      Andrew Scharbarth
      最後由 編輯

      I was curious if there was a way to get the program to break large continous blocks of text (stuff converted to base 64, for example) into blocks of characters of a specified length so that they can be easily copied and pasted.

      For example:

      /9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFHd0cks2MHpnR3R5a3pHYVNvNVZrHAIoAGJGQk1EMDEwMDBhYzEwMzAwMDAyYTI1MDAwMDZiNDYwMDAwM2U0OTAwMDA5ZjRiMDAwMGRkNWUwMDAwYmRhYzAwMDBlM2I0MDAwMDgzYmIwMDAwNzhjMTAwMDA4MjYzMDEwMP/iAhxJQ0NfUFJPRklMRQABAQAAAgxsY21zAhAAAG1udHJSR0IgWFlaIAfcAAEAGQADA

      to

      /9j/4 AAQSk ZJRgA BAgAA AQABA AD/7Q CcUGh vdG9z aG9wI DMuMA A4Qkl NBAQA AAAAA IAcAm cAFHd 0cks2 MHpnR 3R5a3 pHYVN vNVZr HAIoA GJGQk 1EMDE wMDBh YzEwM zAwMD AyYTI 1MDAw MDZiN DYwMD AwM2U 0OTAw MDA5Z jRiMD AwMGR kNWUw MDAwY mRhYz AwMDB lM2I0 MDAwM DgzYm IwMDA wNzhj MTAwM DA4Mj YzMDE wMP/i AhxJQ 0NfUF JPRkl MRQAB AQAAA gxsY2 1zAhA AAG1u dHJSR 0IgWF laIAf cAAEA GQADA

      1 條回覆 最後回覆 回覆 引用 0
      • MAPJe71M
        MAPJe71
        最後由 編輯

        Use search & replace i.e.

        • Ctrl-H
        • Find what: ([\w/]{5})
        • Replace with: \1
        • Search mode: Regular expression
        • Ctrl-A (Replace All)
        1 條回覆 最後回覆 回覆 引用 0
        • MAPJe71M
          MAPJe71
          最後由 編輯

          Sorry, that didn’t work out i.e. trailing space not visible …

          • … as above
          • Replace with: "\1 " i.e. backward-slash + one + space
          • … as above
          1 條回覆 最後回覆 回覆 引用 0
          • guy038G
            guy038
            最後由 編輯

            Hello Andrew,

            An other formulation, which separates any text in blocks of five characters long, whatever they are, would be :

            SEARCH .{5}(?=.)

            REPLACE $0\x20

            Notes :

            • The .{5} syntax matches for five consecutive standard characters

            • I added the look-ahead form (?=.) , just to ensure that NO extra-space will be added, at the end of each long-line scan

            • The $0 syntax represents the match of the whole regex, that is to say, any block of five characters

            • And \x20 is, simply, the hexadecimal form of the space character

            Best Regards,

            guy038

            1 條回覆 最後回覆 回覆 引用 0
            • 第一個貼文
              最後的貼文
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors