Community
    • Login

    Sort numbers in ascending order with Regex

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 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.
    • Bebee BebrtoB Offline
      Bebee Bebrto
      last edited by

      good day, did anyone know how to sort numbers in ascending order with Regex?

      foe example:

      5097
      5794
      5531
      2235
      2234
      1234
      1233
      

      after using regex this must be the output:

      1233
      1234
      2234
      2235
      5097
      5531
      5794
      
      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Bebee Bebrto
        last edited by

        @Bebee-Bebrto

        Why do you want to use “regex”? Regex doesn’t know about “sorting” or about values of numbers, so it is a tough task.

        Have you tried Edit (menu) > Line Operations > Sort Lines As Integers Ascending ??

        1 Reply Last reply Reply Quote 3
        • Bebee BebrtoB Offline
          Bebee Bebrto
          last edited by

          hello. nice. I didn’t know this task on notepad++. Thanks ;)

          1 Reply Last reply Reply Quote 0
          • Bebee BebrtoB Offline
            Bebee Bebrto
            last edited by

            anyway, it would have been useful in regex, though, especially if I have multiple tables similar in multiple files. it is difficult to modify each one individually.

            Alan KilbornA 1 Reply Last reply Reply Quote 0
            • Alan KilbornA Offline
              Alan Kilborn @Bebee Bebrto
              last edited by

              @Bebee-Bebrto said in Sort numbers in ascending order with Regex:

              it would have been useful in regex, though, especially if I have multiple tables similar in multiple files. it is difficult to modify each one individually.

              Well, for that scenario I probably would write an external program to do it and not bother with Notepad++ at all.

              1 Reply Last reply Reply Quote 0
              • Bebee BebrtoB Offline
                Bebee Bebrto
                last edited by

                the idea, maybe, is to make all Edit Options to make replacement in all files, not just in one file.

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors