• Login
Community
  • Login

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

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 4 Posters 640 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S
    Stephen Knapp
    last edited by Jul 5, 2020, 4:35 PM

    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

    A 1 Reply Last reply Jul 5, 2020, 5:22 PM Reply Quote 0
    • G
      guy038
      last edited by Jul 5, 2020, 5:08 PM

      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 Reply Last reply Reply Quote 1
      • A
        Alan Kilborn @Stephen Knapp
        last edited by Jul 5, 2020, 5:22 PM

        @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 Reply Last reply Reply Quote 2
        • G
          guy038
          last edited by Jul 5, 2020, 6:02 PM

          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 Reply Last reply Reply Quote 1
          • T
            Thomas 2020
            last edited by Thomas 2020 Jul 31, 2020, 1:03 PM Jul 31, 2020, 1:02 PM

            or: Extended
            |-
            |-\r\n

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            The Community of users of the Notepad++ text editor.
            Powered by NodeBB | Contributors