Community
    • Login

    function to replace ASCII CR & LF chars eg by spaces

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 5 Posters 5.3k Views 3 Watching
    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.
    • ElectrONICs And SYStemsE Offline
      ElectrONICs And SYStems
      last edited by ElectrONICs And SYStems

      Hello, notepad has a function to replace ASCII CR & LF codes eg by spaces?
      ThankS

      1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones
        last edited by PeterJones

        You can use the Regular Expression mode of Notepad++'s search-and-replace function:

        Search > Replace (often mapped to Ctrl+H)

        • Find What: “[\r\n]” => find either CR or LF
        • Replace With: " " => Replace each CR or LF with a space
        • Search Mode: ☑ Regular Expression

        (the quotes are there to make the space obvious; don’t include the quotes)

        However, that will cause windows-style EOL (CR+LF) to become two spaces
        If you want a CR+LF to become one space, while still converting singleton CR or singleton LF to one space, change to

        • Find What: “\r\n|[\r\n]” => find either CR+LF or CR or LF
          (keeping the other options the same)
        1 Reply Last reply Reply Quote 1
        • ElectrONICs And SYStemsE Offline
          ElectrONICs And SYStems
          last edited by

          Thanks

          Some codes or characters are difficult to remember, then as a suggestion for notepad ++ developers, in the field search please add a table of characters for the purpose of easily paste them

          idea

          http://eonicasys.com.co/public/math/CAS/hp_prime/chars/images/chars_hp_prime_image00.png

          http://eonicasys.com.co/public/math/CAS/hp_prime/chars/images/chars_hp_prime_image01.png

          MaDillM 1 Reply Last reply Reply Quote 0
          • Jim DaileyJ Offline
            Jim Dailey
            last edited by

            @PeterJones and @ElectrONICs-And-SYStems

            You can also use the simpler “\R” to represent any of the various forms of line endings.

            1 Reply Last reply Reply Quote 1
            • MaDillM Offline
              MaDill @ElectrONICs And SYStems
              last edited by

              The idea from @ElectrONICs-And-SYStems is not bad. Before I had ultraedit and they have some kind of help in the search dialog to build regex:

              https://www.ultraedit.com/support/tutorials-power-tips/ultraedit/regular-expression-builder.html

              Also the favorites in the search I used at that time a lot

              https://www.ultraedit.com/support/tutorials-power-tips/ultraedit/search-replace-favorites.html

              When you not need the regex frequently then it is a nice hint to get back in the syntax.

              1 Reply Last reply Reply Quote 0
              • glennfromiowaG Offline
                glennfromiowa
                last edited by

                @ElectrONICs-And-SYStems There is somewhat of a help for characters and codes in ASCII included with Notepad++. In the Edit menu, select Character Panel, and it will display the ASCII characters and codes.

                @MaDill The Find/Replace dialog box does save some number of recent searches; however, it does not allow you to save favorites like the program you used appears to. I know there’s been some discussion on how many searches can be saved, and how to possibly increase that.

                It’s not a bad suggestion, but some users posting here claim that each RegEx is generally unique. However, I for one, do like to have someplace to start when I create a RegEx. Currently, I use a text file with significant RegEx strings and descriptions of them. A limited number of “favourites” would be helpful.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors