Bug: Ignored lines by regex do not work always

General questions about using ExamDiff Pro, ideas for new features, bug reports, and usage tips.
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

Bug: Ignored lines by regex do not work always

Post 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 1120 times
Untitled2.png
Untitled2.png (180.71 KiB) Viewed 1120 times
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post 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)
User avatar
psguru
Site Admin
Posts: 2122
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

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

Post by psguru »

We need your pair of files to debug this. Please either attach here or email.
psguru
PrestoSoft
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post by Alexo »

What address to email to?
User avatar
psguru
Site Admin
Posts: 2122
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

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

Post by psguru »

examdiff at prestosoft.com
psguru
PrestoSoft
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post by Alexo »

Sent
User avatar
psguru
Site Admin
Posts: 2122
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

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

Post 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.
psguru
PrestoSoft
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post 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.
JeremyNicoll
Expert Member
Posts: 101
Joined: Sun May 02, 2010 12:00 pm
Location: Edinburgh

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

Post 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.
User avatar
psguru
Site Admin
Posts: 2122
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

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

Post 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.
psguru
PrestoSoft
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post 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.
User avatar
psguru
Site Admin
Posts: 2122
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

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

Post 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.
psguru
PrestoSoft
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post 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.
User avatar
psguru
Site Admin
Posts: 2122
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

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

Post 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.
psguru
PrestoSoft
User avatar
Alexo
Expert Member
Posts: 127
Joined: Fri Oct 22, 2004 10:18 am
Location: Canada

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

Post by Alexo »

The first two green blocks in the right file are added, and consist only of ignored lines.
Post Reply