Community
    • 登入

    Is there a way to add an "enter" as part of a replace command?

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

      I have a wikitable that I’m compiling and I’ve got each row set as something like

      |-|4 |Destroyer Kamikaze Class |37.5 |102.6 |9.1 |23.2 |2.9 |1398 |100

      I’d like to replace each - sequence with a

      |

      But I can’t seem to figure out how to format the replace

      Alan KilbornA 1 條回覆 最後回覆 回覆 引用 0
      • guy038G
        guy038
        最後由 編輯

        Hello @stephen-knapp and All,

        So, if I understood you, clearly, you have lines like :

        |-|4 |Destroyer Kamikaze Class |37.5 |102.6 |9.1 |23.2 |2.9 |1398 |100
        

        and you expect this resulting text :

        |-
        |4 |Destroyer Kamikaze Class |37.5 |102.6 |9.1 |23.2 |2.9 |1398 |100
        

        Am I right about it ?

        Best Regards

        guy038

        1 條回覆 最後回覆 回覆 引用 1
        • Alan KilbornA
          Alan Kilborn @Stephen Knapp
          最後由 編輯

          @Stephen-Knapp

          To answer the direct question, which was:

          Is there a way to add an "enter" as part of a replace command?

          The answer is yes, use Regular Expression for the Search mode, and use the sequence \r\n in the Replace with box, potentially along with other text.

          1 條回覆 最後回覆 回覆 引用 2
          • guy038G
            guy038
            最後由 編輯

            Hi, @stephen-knapp, @alan-kilborn and All,

            If I presume that my guess was correct, here is the regex S/R :

            • SEARCH ^\|-

            • REPLACE $0\n in an Unix file    OR    $0\r\n in a Windows file

            • Options Wrap around and Regular expression selected

            Best Regards,

            guy038

            1 條回覆 最後回覆 回覆 引用 1
            • Thomas 2020T
              Thomas 2020
              最後由 Thomas 2020 編輯

              or: Extended
              |-
              |-\r\n

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