Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How can I search a specific numbers in between two numbers?

    Help wanted · · · – – – · · ·
    3
    5
    577
    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.
    • RAB_ROAD
      RAB_ROAD last edited by

      Hey,
      I’m new on notepad++, and I want to know how can I lookup for a numbers in between two number:

      Like I want to search in a text file full of numbers and words, and I only want to find the numbers between 250-500, so all the numbers from 250-500 will be in search, in others words, no numbers should be search but only the number between 250-500!

      Terry R 1 Reply Last reply Reply Quote 0
      • Terry R
        Terry R @RAB_ROAD last edited by

        @rab_road said in How can I search a specific numbers in between two numbers?:

        Like I want to search in a text file full of numbers and words, and I only want to find the numbers between 250-500, so all the numbers from 250-500 will be in search, in others words, no numbers should be search but only the number between 250-500!

        You could try the following regular expression. Depending on what you want to do you might use the Mark function so that you can bookmark the lines containing the numbers you are looking for, tick bookmark lines and then use the F2/Shift-F2 to jump between the numbers.

        Also the Mark function can highlight the numbers you want, then you can use the Copy Marked Text, open a new tab and paste them (Ctrl-V).

        Find What(?<!\d)(2[5-9]\d|(3|4)\d\d|500)(?!\d)
        What it does is:
        (?<!\d) - at the cursor position the previous character is NOT a digit
        (2[5-9]\d|(3|4)\d\d|500)(?!\d) - the | character denotes alternation, thus there is the option to take any one of 3 possible steps
        2[5-9]\d - the number starts with 2, then must be either a 5,6,7,8 or 9. The third digit can be anything
        (3|4)\d\d - the number can start with either a 3 or a 4, then the next 2 digits can be anything
        500 - the number must be exactly 500
        (?!\d) - there cannot be any digit following

        If you were to more fully explain what you intend doing with these numbers there might be a better solution, but the above regular expression will locate those numbers and nothing else.

        If you post examples or more information please read the Read Me. This is pinned at the start of this group so new comers can read before asking.

        Terry

        RAB_ROAD 2 Replies Last reply Reply Quote 3
        • RAB_ROAD
          RAB_ROAD @Terry R last edited by

          @terry-r wow you are the best very thanks you man

          1 Reply Last reply Reply Quote 0
          • RAB_ROAD
            RAB_ROAD @Terry R last edited by

            @terry-r said in How can I search a specific numbers in between two numbers?:

            @rab_road said in How can I search a specific numbers in between two numbers?:

            Like I want to search in a text file full of numbers and words, and I only want to find the numbers between 250-500, so all the numbers from 250-500 will be in search, in others words, no numbers should be search but only the number between 250-500!

            You could try the following regular expression. Depending on what you want to do you might use the Mark function so that you can bookmark the lines containing the numbers you are looking for, tick bookmark lines and then use the F2/Shift-F2 to jump between the numbers.

            Also the Mark function can highlight the numbers you want, then you can use the Copy Marked Text, open a new tab and paste them (Ctrl-V).

            Find What(?<!\d)(2[5-9]\d|(3|4)\d\d|500)(?!\d)
            What it does is:
            (?<!\d) - at the cursor position the previous character is NOT a digit
            (2[5-9]\d|(3|4)\d\d|500)(?!\d) - the | character denotes alternation, thus there is the option to take any one of 3 possible steps
            2[5-9]\d - the number starts with 2, then must be either a 5,6,7,8 or 9. The third digit can be anything
            (3|4)\d\d - the number can start with either a 3 or a 4, then the next 2 digits can be anything
            500 - the number must be exactly 500
            (?!\d) - there cannot be any digit following

            If you were to more fully explain what you intend doing with these numbers there might be a better solution, but the above regular expression will locate those numbers and nothing else.

            If you post examples or more information please read the Read Me. This is pinned at the start of this group so new comers can read before asking.

            Terry

            How i can search beetween 4 digits number ? Exemple beetween 1000 and 1500

            Alan Kilborn 1 Reply Last reply Reply Quote 0
            • Alan Kilborn
              Alan Kilborn @RAB_ROAD last edited by

              @rab_road said in How can I search a specific numbers in between two numbers?:

              …between 1000 and 1500

              inclusion of the endpoints is implied? :-)

              (?<!\d)(?:(?:1[0-4]\d\d)|(?:1500))(?!\d)

              1 Reply Last reply Reply Quote 1
              • Referenced by  Alan Kilborn Alan Kilborn 
              • First post
                Last post
              Copyright © 2014 NodeBB Forums | Contributors