Community
    • Login

    Replace help

    Scheduled Pinned Locked Moved General Discussion
    18 Posts 5 Posters 658 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.
    • EkopalypseE
      Ekopalypse
      last edited by

      @Gert-Beliën

      Great :-)

      A short explanation what the regex does,
      it is using a lookbehind (?<=...) for the condition to match .{4}

      ^ means start of line
      2
      .{11} any character but 11 times
      998
      .{35} any character but 35 times

      So basically it means the line has to start with 2, followed by 11 characters, followed by 998, followed by 35 characters and then match the next 4 characters.
      Lookbehind can only be used with a fixed length term to search, which was the case here. :-)

      1 Reply Last reply Reply Quote 1
      • Alan KilbornA
        Alan Kilborn @Ekopalypse
        last edited by

        @Ekopalypse said in Replace help:

        I am still confused by the fact that the position as shown in the statusbar no longer starts at 0.

        You mean the Pos: thing?
        It’s relatively new, right?
        But I believe it has always been “one based”, never “zero based”.

        (I wish it was zero-based, as that would help when writing my PythonScripts – Scintilla always deals with zero-based positions)

        EkopalypseE 1 Reply Last reply Reply Quote 1
        • EkopalypseE
          Ekopalypse @Alan Kilborn
          last edited by

          @Alan-Kilborn said in Replace help:

          But I believe it has always been “one based”, never “zero based”.

          Really, I’m getting old and confused :-D

          PeterJonesP EkopalypseE 2 Replies Last reply Reply Quote 1
          • PeterJonesP
            PeterJones @Ekopalypse
            last edited by

            @Ekopalypse said in Replace help:

            @Alan-Kilborn said in Replace help:

            But I believe it has always been “one based”, never “zero based”.

            Really, I’m getting old and confused :-D

            I’ve always just added a line like

            123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x
            

            when I’m answering positional-based requests, That method works in any version of Notepad++ and doesn’t make me think about 0-based vs 1-based. :-)

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

              @PeterJones said in Replace help:

              I’ve always just added a line like

              Ha! I did that too!:

              bf679ad0-beaa-4454-ac82-e2b7d7e5dd4c-image.png

              (RegexBuddy pictured)

              This, in N++ is even handier, but I can’t find where I’ve put it quickly enough sometimes:

              123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-123456789-
                       10        20        30        40        50        60        70        80        90       100
              
              PeterJonesP 1 Reply Last reply Reply Quote 1
              • EkopalypseE
                Ekopalypse
                last edited by

                @Alan-Kilborn @PeterJones

                Lazy as I’m I looked at the statusbar until I saw 50(thinking it must be 51 because scintilla start from 0) and then selected the dots - which was obviously wrong.

                c9e47f02-981c-4158-86db-5ca8f48f6383-image.png

                1 Reply Last reply Reply Quote 2
                • PeterJonesP
                  PeterJones @Alan Kilborn
                  last edited by PeterJones

                  @Alan-Kilborn said in Replace help:

                  This, in N++ is even handier, but I can’t find where I’ve put it quickly

                  I find it’s faster to re-create than to store in some useful copy-and-paste location. Typing the 10 characters, then duplicating 8+ times, is pretty fast (and almost in my muscle memory now).

                  I suppose we could create macros to insert those. :-)

                  1 Reply Last reply Reply Quote 1
                  • EkopalypseE
                    Ekopalypse
                    last edited by

                    Yeah, we could. Maybe I should have written a python script to do it :-)

                    And now the question, why were the first dots correct? I counted them. :-D

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

                      @Ekopalypse, @Alan-Kilborn, @PeterJones

                      Actually there is a Python script for it. In my configuration is at

                      “D:\Applications\npp.7.9.1.portable.x64\plugins\PythonScript\scripts\Samples\InsertRuler.py”

                      For learning purposes I replicated most of it in AutoHotkey, but I rarely use any of both.

                      Take care and have fun!

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

                        @Ekopalypse said in Replace help:

                        Really, I’m getting old and confused :-D

                        once again …

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