Community
    • Login

    Backward regular expression searching disabled

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 6 Posters 3.2k 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 @ArkadiuszMichalski
      last edited by

      @ArkadiuszMichalski

      You miss my point, but that’s okay. Not everybody is going to “get it” and everyone can have their own opinion (there’s a famous quote about that). And I see from recent issues on github that you are quite opinionated. :-)

      1 Reply Last reply Reply Quote 0
      • Michael VincentM
        Michael Vincent @ArkadiuszMichalski
        last edited by

        @ArkadiuszMichalski said in Backward regular expression searching disabled:

        Such hidden settings should simply be documented, that’s enough.

        My favorite is:

                <GUIConfig name="commandLineInterpreter">powershell</GUIConfig>
        

        Which makes the menu File => Open Containing Folder => cmd actually open PowerShell instead of cmd.exe.

        Cheers.

        ArkadiuszMichalskiA 1 Reply Last reply Reply Quote 2
        • ArkadiuszMichalskiA
          ArkadiuszMichalski @Michael Vincent
          last edited by

          @Michael-Vincent
          Thx, I add your tip to an open bug in the manual. If anyone knows any other hidden settings, please add them directly in the opened bug, it will be easier to describe them later in the manual.
          https://github.com/notepad-plus-plus/npp-usermanual/issues/94

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

            As part of these scripts I’d like to show a “call tip”.
            I can’t seem to make Pythonscript do it, but having never used a call tip before I’m maybe not sure of all I need to do.

            If I try this in the PS console:

            editor.callTipShow(editor.getCurrentPos(), 'blah')
            

            and do it repeatedly, I think I can sometimes see the call tip pop up briefly, and then vanish.

            What am I doing wrong?
            Is there more that I need to do?
            I looked through all of the calltips functions and didn’t see anything relevant:

            editor.callTipActive() 
            editor.callTipCancel()
            editor.callTipPosStart() 
            editor.callTipSetBack(back)
            editor.callTipSetFore(fore)
            editor.callTipSetForeHlt(fore)
            editor.callTipSetHlt(start, end)
            editor.callTipSetPosStart(posStart)
            editor.callTipSetPosition(above)
            editor.callTipShow(pos, definition)
            editor.callTipUseStyle(tabSize)
            

            Help! @Ekopalypse ?

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

              @Alan-Kilborn

              works as long as the editor has the focus but running from console
              puts focus back to textbox control. If you run this within a script you will see it does show blah.

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

                @Ekopalypse

                Ah! Okay, thanks. It seems like I did start within a script and had trouble with it, so (usual debug technique) I was trying console operations to isolate. Looks like this is a case where console ops make it worse, not better. I’ll get back to my script now. :-)

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

                  Well there’s nothing like trying to tackle a problem to show you how difficult it is. :-)

                  And I wasn’t even initially trying to do backward regex searching.

                  I was trying to do a forward search, while considering the caret position.

                  And there were cases that came up that it was just, well, very difficult to handle.

                  For instance, if you search the whole file for matches and then try to select the one at or further on from the caret position (this was the base algorithm), you have a problem if your regex match starts before your caret position and due to a greedy expression it blows through and beyond your caret position. Then you have no frame of reference for really where (to the right of your caret) you really should match. (Starting the search at the caret position doesn’t help because I wanted to handle lookbehinds correctly with this).

                  This probably doesn’t make much sense; you have to “get close to the problem” to fully understand it, perhaps.

                  So, anyway, new respect for those that can write this algorithm correctly!

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

                    @Alan-Kilborn said in Backward regular expression searching disabled:

                    So, anyway, new respect for those that can write this algorithm correctly!

                    And, to date, I’m NOT including the Notepad++ developers in this “respect” (sorry!), because most of us have read the complaints about matching that logically seems like it should occur but doesn’t, i.e., this scenario:

                    Text:

                    ab
                    

                    Caret between the a and the b.

                    Regex search for (?<=a)b won’t match the b.

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

                      Hello @alan-kilborn and All,

                      Don’t forget that, in addition to the basic algorithms, used in our modern regex engines, they usually perform a lot of internal optimizations. For instance, to avoid backtracking process, dead-end searches and other goodies !

                      Such a big task, indeed !


                      Regarding your example :

                      • if the Wrap around option is not ticked the regex matches the b letter, ONLY IF  the caret location is before the a letter

                      • if the Wrap around option is ticked, obviously, the regex matches the b letter, whatever the caret location !

                      Not that, with the enhanced regex engine of François-R Boyer, and tested with N++ v6.9, it does match the b letter with :

                      • The Wrap around not ticked

                      • The caret located between letters a and b

                      Best Regards,

                      guy038

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

                        @guy038 said in Backward regular expression searching disabled:

                        with the enhanced regex engine of François-R Boyer

                        Too bad we can’t dust off Monsieur Boyer and get him to do some more work on Notepad++ codes! :-)

                        Regarding your example

                        Right. The example was done because everyone wants it to work like I suggested (via counterexample). Because you can logically see the “a” there before the “b”. Nothing more.

                        Nobody wants to do crazy workarounds (or have to keep in mind some special things) to find it. Workarounds are fine, but situations like the one I described are potential time suckers: “Notepad++ said my data was not matched, so I spent an hour or 2 working from the assumption that it was right and did this and that and blahblahblah and in the end it was all for nothing, because of the original “lie” that was told”.

                        1 Reply Last reply Reply Quote 0
                        • Makwana PrahladM
                          Makwana Prahlad Banned
                          last edited by

                          Hello,@Alan-Kilborn

                          Follow this step,To Backward regular expression searching disabled

                          Step 1:- Start Notepad++ 7.5 (32-bit) from a fresh unzip of the portable install.
                          Step 2:- Execute any Find operation with Regular Expression as the search mode (note that when the search mode is changed to Reg Exp the “backward direction” checkbox becomes disabled–correct behavior).
                          Step 3:- Quit and restart Notepad++ 7.5.
                          Step 4:- Invoke the Find dialog. Note that the search mode is Reg Exp but the “backward direction” checkbox is now incorrectly enabled.

                          I hope this information will be useful for you.
                          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