Page 1 of 2

Bug: Ignored lines by regex do not work always

Posted: Sun Apr 10, 2022 7:35 pm
by Alexo
For the following regex:

Code: Select all

setting name='[^']*(icon|signedo|lasts|last_s|mute|photo)[^']*'
Some matching lines are still displayed in red or blue:
Untitled.png
Untitled.png (166.3 KiB) Viewed 5196 times
Untitled2.png
Untitled2.png (180.71 KiB) Viewed 5196 times

Re: Bug: Ignored lines by regex do not work always

Posted: Sun Apr 10, 2022 7:37 pm
by Alexo
Forgot to add arrows to the 1st screenshot, but it happens there as well.

Also: seems to happen when the line is missing in the other file, but not consistently.

Interestingly, does not seem to happen with this regex:

Code: Select all

setting name='[^']*(icon|signedo|last|mute|photo)[^']*'
(but that's not the one I need)

Re: Bug: Ignored lines by regex do not work always

Posted: Mon Apr 11, 2022 8:38 am
by psguru
We need your pair of files to debug this. Please either attach here or email.

Re: Bug: Ignored lines by regex do not work always

Posted: Mon Apr 11, 2022 1:42 pm
by Alexo
What address to email to?

Re: Bug: Ignored lines by regex do not work always

Posted: Mon Apr 11, 2022 1:43 pm
by psguru
examdiff at prestosoft.com

Re: Bug: Ignored lines by regex do not work always

Posted: Mon Apr 11, 2022 2:52 pm
by Alexo
Sent

Re: Bug: Ignored lines by regex do not work always

Posted: Mon Apr 11, 2022 2:58 pm
by psguru
Received. The lines in question are actually ignored, you can see it if you enable "Use Ignored color in Added/Deleted blocks" under Options | Misc. See https://www.prestosoft.com/ps.asp?page= ... sc_options for the description of this option.

Re: Bug: Ignored lines by regex do not work always

Posted: Mon Apr 11, 2022 3:36 pm
by Alexo
Hmmm... Then why am getting different behaviour with the two filters?

Specifically:

Code: Select all

setting name='[^']*(icon|signedo|lasts|last_s|mute|photo)[^']*'
Colours the lines differently based on that setting.

While

Code: Select all

setting name='[^']*(icon|signedo|last|mute|photo)[^']*'
Colours the lines the same, regardless of the setting.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 6:21 am
by JeremyNicoll
I'm unconvinced that the regexes are doing what you want. As far as I can see:

setting name='[^']*(icon|signedo|lasts|last_s|mute|photo)[^']*'

looks for

the literal "setting name='"
then zero or more instances of not-single-quote
then one of a set of literals
then zero of more instances of not-single quote
then a literal single quote

Depending on how the regex engine works, the first instance of the "zero or more instances of not-single-quote" might consume all of the characters in the name= attribute, up until its closing single quote, when you need it not to do that, to find the "icon" and other portions of the attribute names.

I don't know why the two different regex expresssions behave differently.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 9:10 am
by psguru
Your second regex matches more lines, thus ignoring what used to be added blocks and changing the results of comparison. FYI, EDP uses the Boost Regex engine.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 1:01 pm
by Alexo
No, the regexes are doing exactly what I intend them to do, I am just not explaining it very well. Images to the rescue!

First set of images, using the setting name='[^']*(icon|signedo|last|mute|photo)[^']*' regex:

setting unchecked

setting checked

Note that the two options produce exactly the same result.


Second set of images, using the setting name='[^']*(icon|signedo|lasts|last_s|mute|photo)[^']*' regex:

setting unchecked

setting checked

Note that the two options produce very different results.


Yes, the two regexes match different sets of strings, but that is not the point.
The issue is that the "Use ignored color in Added/Deleted blocks" option appears to behave inconsistently.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 1:09 pm
by psguru
Your images are not showing up. But I suspect you misunderstand the option. It's about Added/Deleted blocks only, no Changed. The reason is you normally don't want to see ignored lines is that the block is added/deleted anyway, and these ignored lines are inside it.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 1:19 pm
by Alexo
Those are links, not images (images were too large to attach or embed). Please click on them.

And yes, it is about added/deleted blocks, not changed.

And I do want to see ignored lines, because they split the blocks, allowing me to copy only the non-ignored parts.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 2:46 pm
by psguru
Where's the inconsistency? In the first pair the results are the same since the only difference, an added block, does not have any ignored lines, so there's nothing to mark with the option.

Re: Bug: Ignored lines by regex do not work always

Posted: Tue Apr 12, 2022 3:56 pm
by Alexo
The first two green blocks in the right file are added, and consist only of ignored lines.