Community
    • Login

    function to replace ASCII CR & LF chars eg by spaces

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 5 Posters 4.6k 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.
    • ElectrONICs And SYStemsE
      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
        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
          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
            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
              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
                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
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors