Community
    • Login

    Function list regex debugging

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    function listdebug
    25 Posts 7 Posters 2.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.
    • PeterJonesP
      PeterJones @sdasda7777
      last edited by

      @sdasda7777 said in Function list regex debugging:

      I didn’t find this sort of “practical information” in there 😅

      Realize, that Regex 101 uses PCRE, and Notepad++ uses the Boost Regex.

      I see, that’s exactly the sort of information I was looking for, thanks.

      940a87a0-cb6f-4499-a670-0e06ff847976-image.png

      Makes it quite explicit that Notepad++ uses Boost 1.80. I’m not sure what more could be said in the User Manual to give you that piece of “practical information”. (For example, do you really expect the Notepad++ User Manual to tell you what brand of regex engine regex101 website uses? If it did, it would have to tell you for all other such websites, which would be impractical and outside the scope of documenting the Notepad++ application.)

      S 1 Reply Last reply Reply Quote 2
      • S
        sdasda7777 @PeterJones
        last edited by sdasda7777

        @PeterJones It’s not on the function list site, and I admit I didn’t think it would be on the regular expressions site but on the function list site. I apologize.

        do you really expect the Notepad++ User Manual to tell you what brand of regex engine regex101 website uses?

        Of course not. What makes you think that?

        EkopalypseE PeterJonesP 2 Replies Last reply Reply Quote 0
        • EkopalypseE
          Ekopalypse @sdasda7777
          last edited by

          hmmm … in theory it should be possible to create a python script that replicates the behavior of NPP.
          Of course not with Python re module or the research method, but searchInTarget to really use Npps re-engine.

          S 1 Reply Last reply Reply Quote 0
          • S
            sdasda7777 @Ekopalypse
            last edited by

            @Ekopalypse I don’t really want to replicate N++ behaviour per se, I really just want to debug it. Getting the same result is meaningless when a regex doesn’t work, I want to know why precisely it doesn’t work.

            EkopalypseE 1 Reply Last reply Reply Quote 0
            • PeterJonesP
              PeterJones @sdasda7777
              last edited by PeterJones

              @sdasda7777 said in Function list regex debugging:

              @PeterJones It’s not on the function list site, and I admit I didn’t think it would be on the regular expressions site but on the function list site. I apologize.

              do you really expect the Notepad++ User Manual to tell you what brand of regex engine regex101 website uses?

              Of course not. What makes you think that?

              Of course I didn’t really think that; I was using an exaggerated interpretation to show you that you had made a mistake, because the information is in the User Manual, even though you didn’t find it.

              But exaggerations aside, I will try to see if I can try to make it more obvious in the User Manual, without repeating too much information.

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

                @PeterJones said in Function list regex debugging:

                I will try to see if I can try to make it more obvious in the User Manual, without repeating too much information.

                I am curious, when you were reading the User Manual on the Function List page, did you see this section?
                436fd8ab-d7a5-4fdb-a332-72af425dd8a5-image.png

                Because the link there takes you to the beginning of the Regular Expressions section of the Manual, whose first sentence (shown above) does give the Boost version number.

                I’ll still try to make it even more clear, but I need to understand what parts are causing confusion to be able to figure it out.

                S 1 Reply Last reply Reply Quote 2
                • S
                  sdasda7777 @PeterJones
                  last edited by

                  @PeterJones Yeah, I did, but I didn’t assume it would be what I’m looking for. In hindsight I absolutely should have looked there. Maybe this section could hint the library and version is on the other page, but I do see this as an user error, so not sure 😅

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

                    @sdasda7777 said in Function list regex debugging:

                    I’m looking for the sort of debugger that regex101 has, where you can step through the execution to see where exactly it goes wrong

                    Commercial: RegexBuddy can debug Boost regexes.

                    S Lycan ThropeL 2 Replies Last reply Reply Quote 1
                    • PeterJonesP
                      PeterJones @sdasda7777
                      last edited by PeterJones

                      @sdasda7777 said in Function list regex debugging:

                      @PeterJones Yeah, I did, but I didn’t assume it would be what I’m looking for. In hindsight I absolutely should have looked there. Maybe this section could hint the library and version is on the other page,

                      I had hoped that “… syntax spelled out in the docs on Searching: Regular Expressions” would be enough of a hint. Apparently not.

                      Possible new paragraph in the Notes on regular expressions for parsers section:

                      Because the Function List parser uses a subset of the same regular expression syntax that Notepad++ uses for Search > Find regular expressions, you can use Notepad++'s search dialog with Search Mode set to ☑ Regular Expression to experiment with the searches. (If you choose to use some other tool – like one of the many web-based regex explainers – to help you debug your expression for your Function List definition, please understand that there are many implementations of regular expressions, and even very similar implementations have subtle differences in behavior. You would need to find a tool that uses the exact same Boost library version that Notepad++ uses to have their results be identical. The Searching: Regular Expressions section should always list the version of the Boost library used by the most recent Notepad++, and will be updated if Notepad++ ever moves from Boost to some other regular expression library.)

                      Because you aren’t the first to be confused by those tools, either for Function List parsers or Notepad++ searching in general, I am also thinking of updating the first paragraph of the Searching: Regular Expressions to be:

                      Notepad++ regular expressions (“regex”) use the Boost regular expression library v1.80 (as of NPP v8.4.7), which is based on an old PCRE (Perl Compatible Regular Expression) syntax, only departing from it in very minor ways. Complete documentation on the precise implementation is to be found on the Boost pages for search syntax and replacement syntax. (Some users have misunderstood this paragraph to mean that they can use one of the regex-explainer websites that accepts PCRE and expect anything that works there to also work in Notepad++; this is not accurate. There are many different “PCRE” implimentations, and Boost itself no longer claims to be “PCRE”, though both Boost and PCRE variants have the same origins in an early version of Perl’s regex engine. If your regex-explainer does not claim to use the same Boost engine as Notepad++ uses, there will be differences between the results from your chosen website and the results that Notepad++ gives.)

                      Let me know if you think that clarifies things more

                      1 Reply Last reply Reply Quote 1
                      • S
                        sdasda7777 @Alan Kilborn
                        last edited by

                        @Alan-Kilborn

                        Commercial: RegexBuddy can debug Boost regexes.

                        Interesting, thanks for bringing it to attention! 😄 But it’s €40, which I assume most people aren’t willing to spend on a tool they expect to use once 😕

                        mkupperM Alan KilbornA 2 Replies Last reply Reply Quote 0
                        • EkopalypseE
                          Ekopalypse @sdasda7777
                          last edited by

                          @sdasda7777

                          I was thinking more along the lines of visualizing what is found and in case of an invalid regex seeing the information why it failed but … that can’t replace a regex debugger, surely not.

                          1 Reply Last reply Reply Quote 0
                          • mkupperM
                            mkupper @sdasda7777
                            last edited by

                            @sdasda7777 brings good questions which I’ll rephrase as

                            How do the developers and maintainers of function list definitions do it? What tools are they using?

                            MAPJe71M 1 Reply Last reply Reply Quote 1
                            • MAPJe71M
                              MAPJe71 @mkupper
                              last edited by

                              @mkupper

                              RegexBuddy

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

                                @sdasda7777 said in Function list regex debugging:

                                which I assume most people aren’t willing to spend on a tool they expect to use once

                                Well, I bought it based upon someone else’s advice here, and I use it all the time, not just for Notepad++ purposes. To me it was money well spent. Each has to judge for himself.

                                S 1 Reply Last reply Reply Quote 3
                                • S
                                  sdasda7777 @Alan Kilborn
                                  last edited by

                                  @Alan-Kilborn Of course. As I said, I really do appreciate that you suggested it, because I have no doubt for someone who knows they will be sticking around it will be an easy choice.

                                  1 Reply Last reply Reply Quote 0
                                  • Lycan ThropeL
                                    Lycan Thrope @Alan Kilborn
                                    last edited by Lycan Thrope

                                    @Alan-Kilborn ,
                                    Thanks @Alan-Kilborn , for bringing that option up, as I forgot to mention that, since I bought them myself, too, but after my initial trials and tribulations with Regex. I actually bought both, Regex Buddy and Regex Magic.

                                    However, it just became easier to use the Regex101 for quick dirty checks on my small code chores, as there is so many options and such in those programs, that at the time, it was like learning 3 sets of the Encyclopedia, one for NPP, one for Regex, and one for the Regex Buddy/Magic options. Was going dizzy back then, as I remember mentioning. :-)

                                    However, since then, I have used those tools more, using the search box inside NPP itself along with Mark, etc, but also still on occasion use the Regex101 site, since i have the link in the same menu area as the Notepad++ links, so it’s quick and easy. :)

                                    So there is one more tool for him to get what he needs to learn provided, he’s seriously interested. :-)

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

                                      @Lycan-Thrope said in Function list regex debugging:

                                      but also still on occasion use the Regex101 site, since i have the link in the same menu area as the Notepad++ links, so it’s quick and easy

                                      I have my Run menu set up with a command to “Launch RegexBuddy”, thus making it as simple as what you’re saying that you have for regex101.


                                      RegexBuddy has a lot of options because it is very powerful. It’s always a struggle between simplicity and power, where a UI design is concerned – just consider Notepad++ itself.


                                      But we’ve probably strayed off-topic too much with talk of RegexBuddy.

                                      The important point I wanted to make was that people continually use regex101 and then, for more complex expressions, complain that Notepad++ isn’t acting the same way…and the reason for that is that they use different engines and neither one is wrong (but there is only something wrong when you compare different results obtained).

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