• Login
Community
  • Login

function to replace ASCII CR & LF chars eg by spaces

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 5 Posters 4.7k 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.
  • E
    ElectrONICs And SYStems
    last edited by ElectrONICs And SYStems Aug 9, 2017, 3:15 AM Aug 9, 2017, 3:14 AM

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

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by PeterJones Aug 9, 2017, 1:02 PM Aug 9, 2017, 1:01 PM

      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
      • E
        ElectrONICs And SYStems
        last edited by Aug 9, 2017, 4:11 PM

        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

        M 1 Reply Last reply Aug 10, 2017, 9:22 AM Reply Quote 0
        • J
          Jim Dailey
          last edited by Aug 9, 2017, 7:28 PM

          @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
          • M
            MaDill @ElectrONICs And SYStems
            last edited by Aug 10, 2017, 9:22 AM

            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
            • G
              glennfromiowa
              last edited by Aug 10, 2017, 6:20 PM

              @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
              1 out of 6
              • First post
                1/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors