Community
    • Login

    not sure if this can be done...

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 3 Posters 385 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.
    • QiShQ 42Q
      QiShQ 42
      last edited by

      hi, im kind of new noob user can you help me with this? i will try to explain,
      first im taking first 10 lines (1 to 10) and counting how many 7s,10s,Bs…in there and after that i try to find another 10 lines that have the same number of 7s,10s,Bs… with random order , so how can i do it?

      1637602102585-untitled-project.jpg

      PeterJonesP Terry RT 2 Replies Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @QiShQ 42
        last edited by PeterJones

        @qishq-42 ,

        That sounds like a programming challenge, not something that a text editor should do.

        If you know or are willing to learn the Python programming language, you could use the PythonScript plugin in Notepad++ to give your program easy access to the file open in Notepad++, to facilitate your task. And there are similar programs for other languages, like Lua or JavaScript.

        But in the end, it’s a programming problem.

        1 Reply Last reply Reply Quote 4
        • Terry RT
          Terry R @QiShQ 42
          last edited by

          @qishq-42 said in not sure if this can be done...:

          i try to find another 10 lines that have the same number of 7s,10s,Bs… with random order , so how can i do it?

          I’ve had a think and also looked at your previous request about 3 weeks ago, very similar to this. That request looks like it was solved by a regular expression, this however I don’t think can be.

          I’m going to suggest it would require using a programming language such as PythonScript which is available inside of Notepad++. However I’m not a programmer. In english terms it would require:

          1. reading the first 10 lines and storing the number of 7, 10 and B’s
          2. setting a pointer just beyond the first 10 lines then
          3. reading the next 10 lines and counting within that character string each of the variables and comparing. If found to be the same number then stop else
          4. advance the pointer 1 line and repeat step #3

          Terry

          PS just about to post when I see @PeterJones backs up my theory.

          QiShQ 42Q 1 Reply Last reply Reply Quote 3
          • QiShQ 42Q
            QiShQ 42 @Terry R
            last edited by

            @terry-r @PeterJones
            thank you guys , i wasn’t sure about this , i guess that this can be done with regex but it is complicated for example :
            if we have 3 lines :
            10
            7
            B
            so we have to calculate the possibility of the orders which is 3!=3x2x1=6
            and the 6 possibilities are:
            107B,10B7,710B,7B10,B710,B107
            now that can be translated to regex i guess like this:
            1[^\n]\n2[^\n]\n3|
            1[^\n]\n3[^\n]\n2|
            2[^\n]\n1[^\n]\n3|
            2[^\n]\n3[^\n]\n1|
            3[^\n]\n2[^\n]\n1|
            3[^\n]\n1[^\n]\n2

            the problem is with 10 lines there is 10! which is big number im looking for a way to make this simpler is that possible?

            i will check that plugin by the way

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @QiShQ 42
              last edited by

              @qishq-42 said in not sure if this can be done...:

              im looking for a way to make this simpler is that possible?

              Yes, it’s called programming.

              Regex doesn’t have the concept of counting that your desired algorithm requires. You either have to set up the N! conditionals in the regex, or you have to use a tool – like a programming language – that handles counting and other such conditional tasks much more simply than can be done in regular expressions.

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