• Login
Community
  • Login

Search for range of values

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
7 Posts 2 Posters 1.8k 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.
  • T
    Thomas Klinghan
    last edited by Mar 2, 2022, 10:13 AM

    Special “search and replace” problem

    Hello Notepad++ Community! I can’t find a solution for my Notepad++ problem. Maybe you can help me. I’m trying to search in a column for values that are inside a range. With the command

    B[a-c]A
    

    I can search between values.

    But I have to search between numeric values with dot comma. So the values are 6936.750 6943.000 6955.00 … and now I want to find all values between 6900 and 7000.
    Somethinks like this:

    6900.000[1-9]7000.000
    

    After finding all the values in this range, I would delete these lines with Strg+Shift+L.

    Does anyone have a solution for me? Thanks a lot!

    A 1 Reply Last reply Mar 2, 2022, 11:52 AM Reply Quote 0
    • A
      Alan Kilborn @Thomas Klinghan
      last edited by Alan Kilborn Mar 2, 2022, 11:53 AM Mar 2, 2022, 11:52 AM

      @thomas-klinghan said in Search for range of values:

      I’m trying to search in a column

      If you mean to do this by selecting a column block first…then it can’t be done.

      (Well, I did post a SOLUTION to that using PythonScript plugin)

      @thomas-klinghan said in Search for range of values:

      I want to find all values between 6900 and 7000.

      Find: \b69\d{2}\.\d+

      If you really want 7000.0… to be included, you could do a separate search for it:

      Find: \b7000\.\d+

      @thomas-klinghan said in Search for range of values:

      I would delete these lines

      Probably use the Mark function with Bookmark line ticked. Then Delete Bookmarked Lines.

      T 1 Reply Last reply Mar 2, 2022, 12:13 PM Reply Quote 1
      • T
        Thomas Klinghan @Alan Kilborn
        last edited by Mar 2, 2022, 12:13 PM

        @alan-kilborn
        Hello Alan,
        thanks for your quick and helpful reply. The search method with … worked. But would like to search for the values and then automatically replace them with “delete row”.
        I can use the Replace = $1 command to delete the row contents, but the row still exists as CRLF. Do you have a solution how I can remove the row with a replace?

        Bevor_Serach_Replace.JPG After_Serach_Replace.JPG

        Thanks

        A 1 Reply Last reply Mar 2, 2022, 12:17 PM Reply Quote 0
        • A
          Alan Kilborn @Thomas Klinghan
          last edited by Mar 2, 2022, 12:17 PM

          @thomas-klinghan said in Search for range of values:

          I can use the Replace = $1 command to delete the row contents, but the row still exists as CRLF

          Not sure what you mean by “Replace = $1” if you are talking about deleting the “row”(line), but… you can get the “CRLF” included in your Find text by adding a \R at the far right. Then if you replace with something/nothing, the CRLF will get replaced (removed) as well as the other matched text.

          T A 2 Replies Last reply Mar 2, 2022, 1:06 PM Reply Quote 1
          • T
            Thomas Klinghan @Alan Kilborn
            last edited by Mar 2, 2022, 1:06 PM

            @alan-kilborn
            Okay, I get it. I added an \R to the replace field. I now search for \b69\d{2}\.\d+ and replace it with a \R. Unfortunately I don’t get the desired result. I would like to search for the lines that look for a value in the range of 6900 and delete this line.
            By replacing with \R I get only a R CRLF (see photo).
            1.jpg

            In the end my text file should only consist of lines that contain the values in a range of values and no empty lines. (see photo)

            2.jpg

            Unfortunately I can’t find a solution for this problem.

            1 Reply Last reply Reply Quote 0
            • A
              Alan Kilborn @Alan Kilborn
              last edited by Mar 2, 2022, 1:10 PM

              @Thomas-Klinghan

              You misread what I said:

              you can get the “CRLF” included in your Find text by adding a \R at the far right.

              I didn’t say add the \R to your replace text, I said add it to your find text, thus:

              Find: \b69\d{2}\.\d+\R

              T 1 Reply Last reply Mar 2, 2022, 1:12 PM Reply Quote 2
              • T
                Thomas Klinghan @Alan Kilborn
                last edited by Mar 2, 2022, 1:12 PM

                @alan-kilborn said in Search for range of values:

                \b69\d{2}.\d+\R

                ahhhh sorry for my misunderstanding.

                Thank you very much :-)

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