Community
    • Login

    How to remove empty strings by notepad++?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    notepad++ 8.8.3 64-bit
    4 Posts 3 Posters 60 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.
    • РакеР
      Раке
      last edited by

      Dear Sir,
      I tried to remove empty strings in my text using replace \r\n (extended symbols) to remove empty strings, but the new text had correct strings about 260 rows, then all strings were glued in one string. Coding Utf-8.
      How it may be?
      Your,
      Radmir.

      PeterJonesP mathlete2M 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Раке
        last edited by

        @Раке ,

        extended search \r\n finds every line ending, whether or not the line was empty.

        if by “empty strings” you mean “lines that contain no characters other than the line ending”, the easiest way to remove them is Edit > Line Operations > Remove Empty Lines. If you want to remove “lines that contain no characters other than spaces and tabs and the line ending”, then Edit > Line Operations > Remove Empty Lines (Containing Blank Characters)

        The equivalent can also be done in regular expression search-and-replace, but since it’s a built-in feature, just use the menu command.

        РакеР 1 Reply Last reply Reply Quote 2
        • РакеР
          Раке @PeterJones
          last edited by

          @PeterJones
          Your answer is the best solution for my problem, exuse me, I tried to use “search and relace” and can’t guess to use native “edit” feature…
          Thanks,
          Rake.

          1 Reply Last reply Reply Quote 0
          • mathlete2M
            mathlete2 @Раке
            last edited by

            @Раке if you still prefer using a Regex-based Search and Replace, you can add a Start of Line anchor (and perhaps the whitespace character class with a quantifier) to get similar results. For example, a search of ^\s*\r\n will remove all “empty” lines, including ones with various types of whitespace.

            Sample start text:

            c8db255e-b5b8-4d9d-b85c-db4da28525d5-image.png

            After running the S/R with the above Regex:

            a6fef303-5305-4289-9f25-8f4ebfd36ff9-image.png

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