Community
    • Login

    Sort numbers in ascending order with Regex

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    6 Posts 2 Posters 1.4k 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
      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
        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
          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
            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
              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
                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
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors