Community
    • Login

    Reorganize numbers

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 230 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.
    • Handa FlockaH
      Handa Flocka
      last edited by

      Hello
      I have a form like this:
      seven characters - three numbers - two - two numbers
      live example:
      7777777 - 123 - 12 - 12
      I want to reorganize the form and put every three i have in list in the last of the line
      to become like this
      7777777 - 12 - 12 - 123

      is this possible by using notepad++?
      Thanks!

      1 Reply Last reply Reply Quote 0
      • Handa FlockaH
        Handa Flocka
        last edited by Handa Flocka

        “-” is just for separation purpose my form has no “-” inlcluded just spaces

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by guy038

          Hello, @handa-flocka, and All,

          No problem with the regular expression support, natively included within Notepad++ !!

          We’re going to divide any line, with the layout dddddd•••••ddd•••••dd•••••dd ( where d represents a single digit and ••••• any range of characters ) into 7 parts which are stored as group 1, 2,… up to 7

          Then, in replacement, we just re-organize the order of these seven groups !


          • Open the Replace dialog ( Ctrl + H )

          • SEARCH (?-s)^(\d{7})(.+?)(\d{3})(.+?)(\d\d)(.+?)(\d\d)$

          • REPLACE \1\2\7\4\5\6\3

          • Tick preferably the Wrap around option

          • Select the Regular expression search mode

          • Click once on the Replace All button or several times on the Replace button

          Notes :

          • The first part (?-s) ensures that each regex . symbol will match a single standard character only

          • Note that any \d syntax represents an individual digit, possibly repeated

          • Any part .+? stands for the smallest range of non-null standard characters between two numbers

          • Each group n is created by embedding an expression between parentheses, in the search regex and re-used , in replacement, with the \n syntax

          Best Regards

          guy038

          1 Reply Last reply Reply Quote 1
          • Handa FlockaH
            Handa Flocka
            last edited by

            Thank you!! @guy038
            I got it and I got the idea thanks for further explanations

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