Function list regex debugging
-
@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.
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.)
-
@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?
-
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 theresearch
method, butsearchInTarget
to really use Npps re-engine. -
@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.
-
@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.
-
@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?
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.
-
@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 😅
-
@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.
-
@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
-
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 😕
-
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.
-
@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?
-
RegexBuddy
-
@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.
-
@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.
-
@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. :-)
-
@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).