Multi-lines regex, in "Free Spacing" mode, does NOT work in the "Find in Files" and "Find in Projects" dialogs
-
@guy038 said in Multi-lines regex, in “Free Spacing” mode, does NOT work in the “Find in Files” and “Find in Projects” dialogs:
does not seem to interest many people
I think this is probably true; likely because in Notepad++ I don’t think free-spacing mode has much use. Interactively I mean. I think it has use in, say, the function-list parsers, where different sections of the regex is “broken” out and can thus be better commented.
-
Can the current NPP be updated to latest boost version? regexpressions I’ve written for my functionlist work on online test sites but don’t act the same way in NPP v8.4.7 that I have.
Boost is the regexpresson for NPP, but online websites for test Rexp use PCRE2 v10.42 (latest) version and give different results that work. However, I did post a bug report for a simple negated character class positive lookbehind issue. -
@swegmike said in Multi-lines regex, in “Free Spacing” mode, does NOT work in the “Find in Files” and “Find in Projects” dialogs:
Can the current NPP be updated to latest boost version?
Boost was updated to 1.80.0 in Notepad++ 8.4.7.
That’s fairly up-to-date.
Did you have something different in mind?Boost is the regexpresson for NPP, but online websites for test Rexp use PCRE2 v10.42 (latest) version and give different results that work.
Confused by this… I think if you want to use N++ features (e.g. function-list) then you have to adapt to whatever engine that N++ is using. The fact that your regexes “work” using something else, is, well, fairly irrelevant.
I did post a bug report for a simple negated character class positive lookbehind issue.
Where did you do this? It’s a reasonable expectation that when you say something like that you also provide a link.
The bottom line: If you say something isn’t working, but then don’t provide a specific example of WHAT isn’t working, how do you expect anyone to help?
I suppose if your entire question is: Can the current NPP be updated to latest boost version? (and of course you didn’t provide any detail as to what the latest version actually is), then the answer is: Developers will update Boost in N++ when they feel like it, or have a compelling reason to do so.
-
@Alan-Kilborn Ok. However, I think boost is now at v1.81. So as I write my regexp, and test them on online sites for speed and diagnostic purposes (they explain and highlight the steps), I’m comparing the results to what the functionlist results display (which act differently).
Thus two different regexp tool writers, and I’m sorting thru which is more correct. Since I’m not a regexp expert, I’ll need to work thru the different regexp tool outcomes and figure how to get it to work.It would be nice if boost had an online regexp tester to help with speeding up writing the expressions and comparing results so that when I put it into NPP, I will know that it should pretty much work.
To use NPP to do the diagnosing, requires saving the functionlist file, exiting an restarting NPP so that it reads the new language functionlist content in which then requires a refresh functionlist panel against the test code to see what the functionlist results are- a slow process.Weblink to my bug report.
https://github.com/PCRE2Project/pcre2/issues/178 -
@swegmike said in Multi-lines regex, in “Free Spacing” mode, does NOT work in the “Find in Files” and “Find in Projects” dialogs:
It would be nice if boost had an online regexp tester to help with speeding up writing the expressions and comparing results so that when I put it into NPP, I will know that it should pretty much work.
Not free, but… RegexBuddy.
-
@Alan-Kilborn I’ll take a look. Here’s the summary of what I’ve posted to RPE2 github using reges101 tester website who said to post my bug to the RPE2 website.
The following is based on my current understanding.Test string1: Is candy if or mike?
Test string2: Is candy :if or mike?I’ve removed the noncapturing group and simplified it as (?<=[^:])(if)|(mike) for this case it highlights “mike”; however, if the match is changed to {:] , the regex101 will highlight both if and mike when I expect only if to be highlighted.
Now if a named group is specified as, (?‘COND’(?<=[:])(if)|(mike)), it willl highlight both if and mike and if the match is changed to [^:] it will highlight only mike. Thus, in these two cases, it will highlight both when the colon is to be matched.
If the named group switched to a non-named group, the match for [:} will highlight both the if and mike. but for [^:] nothing is highlighted and says no match found in the string to be searched.
So since regex101 website uses PCRE2, it could be info returned for their website to use is the cause, or their website has an issue. Not sure which of the two right now.
-
@swegmike said in Multi-lines regex, in “Free Spacing” mode, does NOT work in the “Find in Files” and “Find in Projects” dialogs:
regex101 website uses PCRE2
And Notepad++ uses boost, as mentioned above, not PCRE2. So PCRE2 behavior is off-topic here. And expecting a PCRE2 regex to work identically in an application that uses Boost shows a lack of understanding that not all regex libraries are identical.
-
@PeterJones In my case, the regular expresion I’m testing is standard regexp regardless of the library i.e. avascript, Java etc. Its the calling api interface that takes the regexpresion and returns a result thats different.
So to determine if ones understanding of the regular is correct, its the expected pattern match one looks at.
If one runs into pattern matching errors not expected, then one can only run it in NPP and if a similar/diff result than expected is observed, the only thing left is to rewrite the regexp by coming up with an alternate regexpression to do the same thing. -
Sorry, your posts are hard to understand, and you are saying things like “match is changed to” when i think you mean “regex is changed to”, and you are quoting (what appear to be) invalid regex sections for many of the “what the match is changed to” statements.
And even trying to ignore all those errors, you still seem to have a misunderstanding, though it’s hard to weed through the noise to be able to tell you where your thinking is wrong.
regex101 will highlight both if and mike when I expect only if to be highlighted.
That doesn’t surprise me. Your regex says to find
if
as long as it’s not preceded by a colon (phrased in a weird way; why not do a negative lookbehind rather than a positive lookbehind with a negated character set), or to find the wordmike
with no other restrictions. And then you make some change to the regex that I don’t understand, and it suddenly matches both. Presumably, you made a change that only affected theif
side of the alternate, which allowedif
to match, but then expected that change on the left side of the|
alternation to also affectmike
; it, of course, will not, so theif
side will matchif
, and then becausemike
hasn’t been consumed,mike
will match as well when the parser gets there. -
@PeterJones I’ll need to think about what you wrote.
However, this is why I was using this particular reqexp based on the help from reg101 tester website. (see their help explanation below).
This seemed to satisfy an If statement true/false condition. For the no part, I was matching another word to see how it worked with the intent of changing this to empty. Then my named group “COND” would be null, but in reality it just matched every word and then marked them as null in the string since there was no match - not what I was expecting either.
So if COND matched “if” show it in the functionlist and if it contained a colon before it skip it and not show it in the functionlist. Moreover, when COND is no/false that the second match of empty, this result wouldn’t be shown in the function list since its null (but I would end with alot of null matches within a line of code being parsed)…Lookahead conditional
(?(?=…)yes|no)
If the lookahead succeeds, matches the pattern before the vertical bar. Otherwise, matches the pattern after the vertical bar. The lookaround can be negative also. Global flag breaks conditionals.
Example: Thus for true it highlights “is delicious”/(?(?=is)(is delicious)|(disgusting))/
Candy is delicious or disgusting.Since the functionlist displays functions, I need to ignore if and while statements and not show them in the functionlist but when they are overloaded by preceding them with :: such as ::if, which can be defined by a function that gives if a modified meaning, I need to show them in the functionlist. Same for while or any operator such as + - / * = etc.