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.
    • Alan KilbornA
      Alan Kilborn @Darren Brown
      last edited by

      @Darren-Brown

      Hmm, no black box. :-(

      1 Reply Last reply Reply Quote 0
      • Darren BrownD
        Darren Brown
        last edited by

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

        PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Darren Brown
          last edited by

          @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
          • Alan KilbornA
            Alan Kilborn @Darren Brown
            last edited by

            @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
            • Darren BrownD
              Darren Brown
              last edited by

              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
              • Darren BrownD
                Darren Brown
                last edited by

                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

                PeterJonesP 1 Reply Last reply Reply Quote 1
                • PeterJonesP
                  PeterJones @Darren Brown
                  last edited by

                  @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
                  • Darren BrownD
                    Darren Brown
                    last edited by

                    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.

                    PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 1
                    • PeterJonesP
                      PeterJones @Darren Brown
                      last edited by

                      @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
                      • Darren BrownD
                        Darren Brown
                        last edited by

                        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
                        • Alan KilbornA
                          Alan Kilborn @Darren Brown
                          last edited by

                          @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.

                          Darren BrownD 1 Reply Last reply Reply Quote 0
                          • Darren BrownD
                            Darren Brown @Alan Kilborn
                            last edited by

                            @Alan-Kilborn Will do, thanks :-)

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