Community
    • Login

    about selection

    Scheduled Pinned Locked Moved General Discussion
    47 Posts 7 Posters 11.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.
    • Terry RT
      Terry R
      last edited by

      @astrosofista said in about selection:

      as you constraint it to only 9 groups.

      Actually I did mention it could be extended and whilst not entirely familiar with the syntax I am aware of the possibility.
      The examples provided only went to 5 or so lines so felt no need to get too complex. As I said a solution had been found and this was partly an exercise in testing my idea as it was different. Possibly it might pay, if OP wants to utilise this idea to first find a method to count max number of lines in any group. That is another question to be answered. I did have a regex which can do it, but it was not elegant.

      Terry

      astrosofistaA 1 Reply Last reply Reply Quote 1
      • cisco779kC
        cisco779k
        last edited by

        tanxs Terry! your reg-ex work fine for my intent! tanxs so much.
        the rest of the discussion went a little off topic … should be moved to a separate post … anyway thanks to everyone for your attention.

        1 Reply Last reply Reply Quote 1
        • cisco779kC
          cisco779k
          last edited by

          in reality i would just like to invert the first with the last line, in any ### field

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

            @cisco779k said in about selection:

            in reality i would just like to invert the first with the last line

            I’m disappointed, not so much that my solution doesn’t now work as that you have totally changed the problem!
            You aren’t the first to pull this stunt and likely won’t be the last but at the moment it is late evening for me so I’m not inclined to bust out my PC just to solve your new problem.

            Terry

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

              Hello, @astrosofista and All,

              In a previous post of that discussion, you said :

              @guy038, let me ask you a question: how do you create those nice tables? Is a free tool? I’m curious.

              Well, in fact, I don’t use any specific tool ! Just the usual column mode editor, with the help, mainly, of 3 characters only :

              • The Hythen-Minus sign -

              • The Equals sign =

              • The Bullet sign •

              I personally like the Bullet sign because it is exactly vertically centered ;-)) It’s Unicode code-point is \x{2022}. Refer to :

              http://www.unicode.org/charts/PDF/U2000.pdf

              Most of the time, you can get it with the keyboard sequence :

              • Hold down the Alt key

              • Hit, successively, on keys 0 , 1, 4 and 9 of the numeric keypad

              • Release the Alt key


              Tables composed with that character look better than using the Asterisk sign ( * ) or the Full Stop/Dot char ( . ). See, examples below :

              •---------------•--------------•---------------•        *---------------*--------------*---------------*        .---------------.--------------.---------------.
              |   LANGUAGE    |  MAIN form   |  OTHER forms  |        |   LANGUAGE    |  MAIN form   |  OTHER forms  |        |   LANGUAGE    |  MAIN form   |  OTHER forms  |
              •---------------•--------------•---------------•        *---------------*--------------*---------------*        .---------------.--------------.---------------.
              |  bash         |  sh          |  bash         |        |  bash         |  sh          |  bash         |        |  bash         |  sh          |  bash         |
              |               |              |               |        |               |              |               |        |               |              |               |
              |  c            |  c           |  h            |        |  c            |  c           |  h            |        |  c            |  c           |  h            |
              |  c++          |  cpp         |  hpp          |        |  c++          |  cpp         |  hpp          |        |  c++          |  cpp         |  hpp          |
              |  c#           |  cs          |               |        |  c#           |  cs          |               |        |  c#           |  cs          |               |
              |  CSS          |  css         |               |        |  CSS          |  css         |               |        |  CSS          |  css         |               |
              |               |              |               |        |               |              |               |        |               |              |               |
              |  DIFF         |  diff        |  patch        |        |  DIFF         |  diff        |  patch        |        |  DIFF         |  diff        |  patch        |
              •---------------•--------------•---------------•        *---------------*--------------*---------------*        .---------------.--------------.---------------.
                                                                                                                              
                                                                                                                              
              •===============•==============•===============•        *===============*==============*===============*        .===============.==============.===============.
              |   LANGUAGE    |  MAIN form   |  OTHER forms  |        |   LANGUAGE    |  MAIN form   |  OTHER forms  |        |   LANGUAGE    |  MAIN form   |  OTHER forms  |
              •===============•==============•===============•        *===============*==============*===============*        .===============.==============.===============.
              |  bash         |  sh          |  bash         |        |  bash         |  sh          |  bash         |        |  bash         |  sh          |  bash         |
              |---------------•--------------•---------------|        |---------------*--------------*---------------|        |---------------*--------------*---------------|
              |  c            |  c           |  h            |        |  c            |  c           |  h            |        |  c            |  c           |  h            |
              |  c++          |  cpp         |  hpp          |        |  c++          |  cpp         |  hpp          |        |  c++          |  cpp         |  hpp          |
              |  c#           |  cs          |               |        |  c#           |  cs          |               |        |  c#           |  cs          |               |
              |  CSS          |  css         |               |        |  CSS          |  css         |               |        |  CSS          |  css         |               |
              |---------------•--------------•---------------|        |---------------*--------------*---------------|        |---------------*--------------*---------------|
              |  DIFF         |  diff        |  patch        |        |  DIFF         |  diff        |  patch        |        |  DIFF         |  diff        |  patch        |
              •===============•==============•===============•        *===============*==============*===============*        .===============.==============.===============.
              

              Best Regards,

              guy038

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

                Hello, @cisco779k, @Terry-r, @astrosofista, @alan-kilborn and All,

                You said in your last post :

                in reality i would just like to invert the first with the last line, in any ### field

                Then, given the input text below :

                pacecececrst$$$!                   pacecececrst$$$!
                ###                                ###
                peerfergeg4Me<123                  ergergerge34r43r343
                17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                ergergerggupload.com/filerge       17ergergom/file/wv7PNHVud9kAerAP3_WO-g/1554th0810.7zg
                ergergerge34r43r343                peerfergeg4Me<123
                ###                                ###
                pasdcd555ye2018                    15o4fkfk4lf,dfmemfgermp
                6664lekrflkeuN3s5lmSigp56ove       6664lekrflkeuN3s5lmSigp56oveKPp6w/erferfef3443r3434
                15o4fkfk4lf,dfmemfgermp            pasdcd555ye2018
                ###                                ###
                17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                ###                                ###
                paerf3904r903ur3jgj                paerf3904r903ur3jgj
                

                The following regex S/R :

                SEARCH (?-s)^(###.+\R)(.+\R)((?:.+\R)*?)(.+\R)(?=^###)

                REPLACE \1\4\3\2

                should get your expected text :

                pacecececrst$$$!                   pacecececrst$$$!
                ###                                ###
                ergergerge34r43r343                peerfergeg4Me<123
                17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                ergergerggupload.com/filerge       17ergergom/file/wv7PNHVud9kAerAP3_WO-g/1554th0810.7zg
                peerfergeg4Me<123                  ergergerge34r43r343
                ###                                ###
                15o4fkfk4lf,dfmemfgermp            pasdcd555ye2018
                6664lekrflkeuN3s5lmSigp56ove       6664lekrflkeuN3s5lmSigp56oveKPp6w/erferfef3443r3434
                pasdcd555ye2018                    15o4fkfk4lf,dfmemfgermp
                ###                                ###
                1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                ###                                ###
                paerf3904r903ur3jgj                paerf3904r903ur3jgj
                

                Best Regards,

                guy038

                1 Reply Last reply Reply Quote 1
                • cisco779kC
                  cisco779k
                  last edited by

                  @Terry-R
                  do not angry! your regex work fine.

                  @guy038
                  tanxs (ever) for your help!
                  but not work for me… why??
                  in some cases i also have 9 lines (between ### field)…

                  alt text

                  1 Reply Last reply Reply Quote 0
                  • cisco779kC
                    cisco779k
                    last edited by

                    @guy038
                    your reg-ex don’t work…
                    please read this post!

                    1 Reply Last reply Reply Quote -2
                    • guy038G
                      guy038
                      last edited by

                      Hello, @cisco779k, @Terry-r, @astrosofista, @alan-kilborn and All,

                      Please, don’t be so rude : I’m only trying to help, freely and I also answer to other people !

                      You said, previously :

                      in reality i would just like to invert the first with the last line, in any ### field

                      and also :

                      in some cases i also have 9 lines (between ### field)…

                      But, given the initial text, below, ( which may not respect your logic ! Just an example )

                      ###                                ###
                      1234567890                         1234567890
                      17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                      1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                      15o4fkfk4lf,dfmemfgermp            pasdcd555ye2018
                      6664lekrflkeuN3s5lmSigp56ove       6664lekrflkeuN3s5lmSigp56oveKPp6w/erferfef3443r3434
                      pasdcd555ye2018                    15o4fkfk4lf,dfmemfgermp
                      1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                      17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                      ergergerggupload.com/filerge       17ergergom/file/wv7PNHVud9kAerAP3_WO-g/1554th0810.7zg
                      ergergerge34r43r343                peerfergeg4Me<123
                      0987676543210                      0987676543210
                      ###                                ###
                      

                      after running my regex S/R :

                      SEARCH (?-s)^(###.+\R)(.+\R)((?:.+\R)*?)(.+\R)(?=^###)

                      REPLACE \1\4\3\2

                      it does give the expected text :

                      ###                                ###
                      0987676543210                      0987676543210
                      17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                      1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                      15o4fkfk4lf,dfmemfgermp            pasdcd555ye2018
                      6664lekrflkeuN3s5lmSigp56ove       6664lekrflkeuN3s5lmSigp56oveKPp6w/erferfef3443r3434
                      pasdcd555ye2018                    15o4fkfk4lf,dfmemfgermp
                      1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                      17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                      ergergerggupload.com/filerge       17ergergom/file/wv7PNHVud9kAerAP3_WO-g/1554th0810.7zg
                      ergergerge34r43r343                peerfergeg4Me<123
                      1234567890                         1234567890
                      ###                                ###
                      

                      Obviously, the first and last line, made of digits only, are inverted ! So what ?

                      Best regards,

                      guy038

                      1 Reply Last reply Reply Quote 2
                      • astrosofistaA
                        astrosofista @guy038
                        last edited by

                        Hi @guy038, All

                        Thank you for getting back to me. I am too a big fan of the bullet • —the symbol, not the projectile :)—. In my numeric keypad the bullet is typed by the sequence you mentioned and also with just Alt + numpad7, but as I used it a lot, usually get it through a hotstring, a triple ooo, which I can easily remember.

                        Concerning your samples, I agree that the bullet looks better than asterisks and dots in ASCII tables. The adding sign + also looks fine when used for crossing single lines.

                        I began to see the seemingly next step in tables, the ones constructed with Unicode characters, but I didn´t found the time yet to deal with them.

                        Well, that’s enough for me and sorry for hijacking the thread.

                        Best Regards.

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

                          @Terry-R said in about selection:

                          find a method to count max number of lines in any group. That is another question to be answered. I did have a regex which can do it, but it was not elegant.

                          Nice and tricky puzzle. Don’t know if it is elegant or not — another question related to the eye of the beholder —, but found a regex solution for it, a long string of 172 characters for the search expression that matches groups up to 10 lines. Can post it, if interested.

                          Best Regards.

                          1 Reply Last reply Reply Quote 1
                          • cisco779kC
                            cisco779k
                            last edited by

                            @guy038
                            I wanted to recall the post, since i didn’t see answers after 2 days and i don’t know how else to contact you. I didn’t want to be rude, it was fair to close the question…

                            well: you have read my post above? with your reply you have published same reg-ex of your previous post.
                            and not work for me… same reg-ex.
                            perhaps it is i who do not understand.
                            now i have this example:

                            ###
                            peerfergeg4Me<123
                            17ergergom/file/wv7PNHVud9kA
                            1ergergergegQy2iSLvFyoduWHrU
                            ergergerggupload.com/filerge
                            ergergerge34r43r343
                            ### 
                            

                            this is only 5 line, but on some case i have field to 9 lines.
                            i want reverse first with last line like this:

                            ###
                            ergergerge34r43r343
                            17ergergom/file/wv7PNHVud9kA
                            1ergergergegQy2iSLvFyoduWHrU
                            ergergerggupload.com/filerge
                            peerfergeg4Me<123
                            ### 
                            

                            on this example your reg-ex not work (for me).

                            EkopalypseE 1 Reply Last reply Reply Quote 0
                            • EkopalypseE
                              Ekopalypse @cisco779k
                              last edited by Ekopalypse

                              @cisco779k

                              What I find confusing is that, when asked again, not to take the trouble
                              to explain exactly where the problem is and what you expect to get as a result.

                              For example your mail from 2 days ago.
                              You write that in some cases it may be that between the ### lines
                              can also be 9 lines to be found and give 5 lines as an example. Confuses me.

                              The whole thing suggests that there could be 10 or 15 or only 2 or 3 lines.
                              You see what I mean?

                              The better and more precise you can ask your question the easier it is for others to help you.
                              If there are problems with the language, I would use an online translator for what I am doing right now.
                              They get better and better the more they are used.

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

                                Hello, @cisco779k, @Terry-r, @astrosofista, @alan-kilborn and All,

                                Oh…, @cisco779k, I’m sorry ! I did not notice the differences between your example, below :

                                ###
                                ergergerge34r43r343
                                17ergergom/file/wv7PNHVud9kA
                                1ergergergegQy2iSLvFyoduWHrU
                                ergergerggupload.com/filerge
                                peerfergeg4Me<123
                                ###
                                

                                and my example :

                                ###                                ###
                                ergergerge34r43r343                peerfergeg4Me<123
                                17ergergom/file/wv7PNHVud9kA       ergergerggupload.com/filerge/uU8CesyKVkPb4MWk_0VqkQ/1554th11.7z
                                1ergergergegQy2iSLvFyoduWHrU       1ergergergegQy2iSLvFyoduWHrUjN7g/1554th18.7zg
                                ergergerggupload.com/filerge       17ergergom/file/wv7PNHVud9kAerAP3_WO-g/1554th0810.7zg
                                peerfergeg4Me<123                  ergergerge34r43r343
                                ###                                ###
                                
                                • In your example, the header string ### is immediately followed with a line-break

                                • In mime, the header string ### is followed with blank chars and an other string ###

                                So the obvious correction to do is to use the following S/R :

                                SEARCH (?-s)^(###.*\R)(.+\R)((?:.+\R)*?)(.+\R)(?=^###)

                                REPLACE \1\4\3\2

                                As you see, only the first + symbol, of the regex, has been changed into a * symbol, meaning that string ###, beginning the line ( ^ ), must be followed by 0 to n standard characters (.* ) before the line-break ( \R ) !

                                I should have remarked this difference before which would have avoided you to post again ;-))

                                Best Regards,

                                guy038

                                1 Reply Last reply Reply Quote 1
                                • cisco779kC
                                  cisco779k
                                  last edited by

                                  @guy038 tanxs you so much for your explanation and for modification to your reg-ex!
                                  now it works very well!
                                  I never said I had an example like yours, but maybe it’s my fault that I didn’t explain myself well …
                                  everything is working fine now. always thanks for your regex!
                                  cheers

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