Community
    • Login

    Find Begin/End setting

    Scheduled Pinned Locked Moved General Discussion
    notes
    21 Posts 5 Posters 7.9k 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.
    • Alan KilbornA
      Alan Kilborn @Javier Rivas
      last edited by

      @Javier-Rivas said in Find Begin/End setting:

      @Javier-Rivas OK the first regex worked, now to test on my real txt file

      Are you talking to yourself? :-)
      Convincing yourself that it really does work?? :-)

      Javier RivasJ 1 Reply Last reply Reply Quote 0
      • Javier RivasJ
        Javier Rivas @Ekopalypse
        last edited by

        @Ekopalypse OK your code works, question, could it also highly the Cod 1 and Cod2, I know I said between, but I thought it would find the Cod1 and Cod2 and include it as well

        Alan KilbornA 1 Reply Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn @Javier Rivas
          last edited by Alan Kilborn

          @Javier-Rivas

          could it also highly the Cod 1 and Cod2, I know I said between, but I thought it would find the Cod1 and Cod2 and include it

          find: Cod1.+?Cod2

          Javier RivasJ 1 Reply Last reply Reply Quote 1
          • Javier RivasJ
            Javier Rivas @Alan Kilborn
            last edited by

            @Alan-Kilborn Perfect

            Alan KilbornA 1 Reply Last reply Reply Quote 2
            • Alan KilbornA
              Alan Kilborn @Javier Rivas
              last edited by

              @Javier-Rivas

              Learn what it does, for yourself for the future:

              • match Cod1 exactly
              • .+? match any single character (the dot means “any single”), one or more times (the + means 1+ times), but as few times as needed (the ? specifies that)
              • match Cod2 exactly

              All 3 of these things must exist for you to have an overall match.

              Javier RivasJ 1 Reply Last reply Reply Quote 1
              • Javier RivasJ
                Javier Rivas @Alan Kilborn
                last edited by Javier Rivas

                @Alan-Kilborn OK, so I have improved the code search to my use so here is my original search
                (?= "caup).+(?= "cues) < — notices the spacing and I removed the <

                first to find is “caup”, and it starts with 2 spaces in front of it
                last to find is “cues”, and it needs to stop 2 spaces before the “cues”

                —“caup”: < ---- it highlights the spaces and the code
                -{
                -adad
                -adasd
                -asdad
                -}
                ], < ------- it stops right here
                —“cues”: < ----- it ignores the spaces and the code

                so now it’s perfect to my standards

                1 Reply Last reply Reply Quote 3
                • Javier RivasJ
                  Javier Rivas @Alan Kilborn
                  last edited by

                  @Alan-Kilborn Yes, I call it motivation…lmao
                  Yea, I wanted to add a comment and I clicked on reply to myself…hahahaha

                  1 Reply Last reply Reply Quote 3
                  • Javier RivasJ
                    Javier Rivas @Alan Kilborn
                    last edited by

                    @Alan-Kilborn there should be a cut mark and and replace mark that would be awesome

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • Alan KilbornA
                      Alan Kilborn @Javier Rivas
                      last edited by

                      @Javier-Rivas said in Find Begin/End setting:

                      there should be a cut mark and and replace mark that would be awesome

                      That would be nice I suppose, but in practice it is not so bad without it.

                      I’d like to see two separate commands: Begin Select and End Select. That way it would be easier to abort a begin-point by setting a new one (if you realize you’ve made a mistake in setting the origin), and it could also be a reminder in the menu that you haven’t yet set the begin point (Begin Select would be enabled and End Select would be disabled).

                      BUT…it is definitely OK the way it currently works. And a downside of two commands is that using it from a shortcut would require two shortcuts to be allocated.

                      Speaking of shortcuts, one thing that is lacking is tying this handy functionality to a shortcut by default. I tie mine to Ctrl+b.

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

                        Hi, @javier-rivas, @ekopalypse and @alan-kilborn and All,

                        @javier-rivas, taking in account your additional information, my regex becomes :

                        MARK (?s-i)^\x20\x20"caup":.+?(?=^\x20\x20"cues":)

                        This regex :

                        • Matches the literal string "caup":, preceded with two space characters ( because of \x20\x20 ) beginning a line, ( because of ^ ), with this exact case ( because of the (?-i) modifier )

                        • Followed with the smallest ( because of ? ) non-null ( because of + ) range of any character ( because of (?s) modifier )…

                        • But ONLY IF followed with the literal string "cues":, preceded with two space characters ( because of \x20\x20 ) beginning a line, ( because of ^ ), with this exact case ( because of the (?-i) modifier ).

                        Note that the (?=......) syntax is a look-ahead structure, in other words a condition, which must be true in order the present match, so far, to be valid but which is never part of the overall match


                        Thus, in the text below :

                          "caup":
                        -{
                        -adad
                        -adasd
                        -asdad
                        -}
                        ],
                          "cues":
                        

                        It would mark and bookmark all the lines but the last one !

                        Cheers,

                        guy038

                        Javier RivasJ 1 Reply Last reply Reply Quote 1
                        • Javier RivasJ
                          Javier Rivas @guy038
                          last edited by

                          @guy038 thank you

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