• Login
Community
  • Login

Replace backslash and new line

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
17 Posts 3 Posters 4.2k 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.
  • A
    Alan Kilborn @Darren Brown
    last edited by Sep 10, 2021, 6:15 PM

    @Darren-Brown

    Hmm, no black box. :-(

    1 Reply Last reply Reply Quote 0
    • D
      Darren Brown
      last edited by Sep 10, 2021, 6:17 PM

      No the spacing was removed so thought the image might be better. How can I retain the spacing? Thanks

      P A 2 Replies Last reply Sep 10, 2021, 6:21 PM Reply Quote 0
      • P
        PeterJones @Darren Brown
        last edited by Sep 10, 2021, 6:21 PM

        @Darren-Brown ,

        By following the tip:

        ```
        123456789a
            Hello World after four spaces
        123456789a
          Two Spaces Then This Line
        ```
        

        renders as

        123456789a
            Hello World after four spaces
        123456789a
          Two Spaces Then This Line
        
        1 Reply Last reply Reply Quote 0
        • A
          Alan Kilborn @Darren Brown
          last edited by Sep 10, 2021, 6:22 PM

          @Darren-Brown said in Replace backslash and new line:

          How can I retain the spacing?

          Get it showing in the black box, as Peter shows, while you are composing, before pressing Submit on your post?

          1 Reply Last reply Reply Quote 0
          • D
            Darren Brown
            last edited by Sep 10, 2021, 6:22 PM

            282882|1|IPLC|B|||ABC123 \
                                                              ||N||||||N||C|30|
            282882|2|IPLC|B|||TEXT  \
                                                    ||N||||||N||C|30|
            

            Got it (hopefully) thanks.

            1 Reply Last reply Reply Quote 2
            • D
              Darren Brown
              last edited by Sep 10, 2021, 6:23 PM

              So I would like it to be -

              282882|1|IPLC|B|||ABC123||N||||||N||C|30|
              282882|2|IPLC|B|||TEXT||N||||||N||C|30|
              

              Thanks

              P 1 Reply Last reply Sep 10, 2021, 6:29 PM Reply Quote 1
              • P
                PeterJones @Darren Brown
                last edited by Sep 10, 2021, 6:29 PM

                @Darren-Brown ,

                FIND = \s*\\\s* – finds zero or more spaces, a literal backslash, and zero or more spaces (where the generic “spaces” can mean SPACE, TAB, NEWLINE, and a few other rare characters)
                REPLACE = empty
                SEARCH MODE = regular expression

                1 Reply Last reply Reply Quote 2
                • D
                  Darren Brown
                  last edited by Sep 10, 2021, 6:32 PM

                  Perfect, thanks, just tried with regular expression for search mode and it does exactly what is needed. Thanks so much, I’ve been trying this for days and not getting anywhere.

                  P A 2 Replies Last reply Sep 10, 2021, 6:34 PM Reply Quote 1
                  • P
                    PeterJones @Darren Brown
                    last edited by Sep 10, 2021, 6:34 PM

                    @Darren-Brown said in Replace backslash and new line:

                    I’ve been trying this for days

                    In case you hadn’t seen it, the ? menu on the Notepad++ menu bar has a menu called “Notepad++ Online User Manual” (or similar; the phrasing changed a few versions back). This takes you to https://npp-user-manual.org/ , which has a detailed description of the application, including a rather large page on searching, and the difference betweeen Normal, Extended, and Regular Expression search modes.

                    1 Reply Last reply Reply Quote 0
                    • D
                      Darren Brown
                      last edited by Sep 10, 2021, 6:35 PM

                      I must admit I read a comment somewhere saying that the help options weren’t much help so haven’t looked, but will definitely refer to it in the future. Thanks again.

                      1 Reply Last reply Reply Quote 0
                      • A
                        Alan Kilborn @Darren Brown
                        last edited by Sep 10, 2021, 6:36 PM

                        @Darren-Brown said in Replace backslash and new line:

                        I’ve been trying this for days and not getting anywhere.

                        In the future, don’t struggle so long before asking. :-)
                        Of course, if you like the power and simplicity of Peter’s solution, you can read more about it, and learn how to derive your own solutions, and you won’t struggle.
                        Look for “regular expression” in the FAQ category.

                        D 1 Reply Last reply Sep 10, 2021, 6:38 PM Reply Quote 0
                        • D
                          Darren Brown @Alan Kilborn
                          last edited by Sep 10, 2021, 6:38 PM

                          @Alan-Kilborn Will do, thanks :-)

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