Ignoring parts in one panel according to expr in other panel

General questions about using ExamDiff Pro, ideas for new features, bug reports, and usage tips.
Post Reply
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Ignoring parts in one panel according to expr in other panel

Post by AlexL »

Hello.

I want to ignore parts of lines in left panel, which are specified according to some regular expression in right panel. Example:

Left file:

12345
12345
12340
12305
12345

Right file:

12345
12345
12345
123X5
12345

I want to ignore differences, where right panel contains "X". In the above example I want to see a difference in line 3 (last line char '0' in the left file does not match char '5' in the right file), but not to see differences in line 4 (char '0' in the left file does not match the right file, but there is 'X' on that place; so I want to ignore this difference).

I can't find the appropriate regular expression.

I'd like to avoid using plugins.

Thank you.
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

While I (as a human) understand what you are trying to achieve, I don't see how EDPro can be told to do it. How would you explain to the program your desire to ignore something like this?
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

psguru wrote:While I (as a human) understand what you are trying to achieve, I don't see how EDPro can be told to do it. How would you explain to the program your desire to ignore something like this?
You are right. I did not clarify the way to specify ignoring regions. I wrote only a not clear hint relating to this: that "I can't find the appropriate regular expression".

The problem is that I don't know all the details how to do this. I think the most simple way will be to invent some regular expression, which will let a user to specify a character to ignore (provided you have access to the sources of RE library, which you use). Maybe it exists, but I did not find it in help.

E.g., it can be probably organized as some mode, which is complemental (or additional) to "Ignore" sections of settings. Or, say, specifying "Ignore character" in comparison settings. I realize that this solution may look not enough general as we want, but it allows to solve a problem. How to make it more general? I wish I know...

Maybe it is general enough, if we look more thoroughly?..

Maybe other forum visitors can suggest, how to solve the problem described in the initial thread message?..

Maybe we need to define some special character set, or interval of characters? One of their speciality will be "Ignore" mode... Though I can't currently imagine other applications except "Ignore". In my case this set will contain only one character 'X'. Or two: "Xx".

Thank you.
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

You can specify a regex that would contain a set of characters using the following syntax:

[xXyZ]

The above will match any of the following characters: x, X, y, Z.

This, however, will not address your problem, since the above characters will be ignored in both files. As far as understand your problem, you need to ignore characters in one file that are positioned "identically" to some predefined characters in the other file.

I doubt that this can be expressed in any meaningful way. I think, even tough you mentioned that you wanted to avoid it, the only way to handle such situations is through the use of plug-ins.

BTW, EDPro uses an open-source regex library -- see Credits in Help for more information.
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

psguru wrote:You can specify a regex that would contain a set of characters using the following syntax:

[xXyZ]

The above will match any of the following characters: x, X, y, Z.

This, however, will not address your problem, since the above characters will be ignored in both files. As far as understand your problem, you need to ignore characters in one file that are positioned "identically" to some predefined characters in the other file.

I doubt that this can be expressed in any meaningful way. I think, even tough you mentioned that you wanted to avoid it, the only way to handle such situations is through the use of plug-ins.

BTW, EDPro uses an open-source regex library -- see Credits in Help for more information.
Yes, I thought about such variant as ignoring [xX]. But first, you are right, they will be ignored in both files. Though this is not the main obstacle (let's suppose I don't have X on the left panel; only hexadecimal numbers). The 2-nd and the main problem is that ignoring X will ignore this column in the current line of the right file, but not of the left. This means that the right line will become shorter than the left (for comparison needs). So they will be different anyway. Am I right?
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

Yes, I thought about such variant as ignoring [xX]. But first, you are right, they will be ignored in both files. Though this is not the main obstacle (let's suppose I don't have X on the left panel; only hexadecimal numbers). The 2-nd and the main problem is that ignoring X will ignore this column in the current line of the right file, but not of the left. This means that the right line will become shorter than the left (for comparison needs). So they will be different anyway. Am I right?
You are absolutely correct. And I don't see a way to ExamDiff Pro to treat those lines as identical.[/quote]
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

psguru wrote:
Yes, I thought about such variant as ignoring [xX]. But first, you are right, they will be ignored in both files. Though this is not the main obstacle (let's suppose I don't have X on the left panel; only hexadecimal numbers). The 2-nd and the main problem is that ignoring X will ignore this column in the current line of the right file, but not of the left. This means that the right line will become shorter than the left (for comparison needs). So they will be different anyway. Am I right?
You are absolutely correct. And I don't see a way to ExamDiff Pro to treat those lines as identical.
So seems there is no way to explain to Examdiff Pro my problem without plugins. And several messages above you wrote that "the only way to handle such situations is through the use of plug-ins". But appeared that I don't know even how to write plugin for this need. As far as I understood from help, a plugin receives one line per call. But I need two lines per call - one from left file, and one from right file. How to do this?

Thank you.
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

The way plug-ins work today is as follows: you pass a file name that is about to be compared (there are built-in variables to do this) to a custom application, and that application creates another file based on some rules. The latter file is then used for comparison instead of the original file.

In you situation a plug-in could take two file names (the file itself and the opposite file) and transform the main file into something else based on the contents of the other file. For example, you plug-in could scan lines in both files, and if in the other file there is 'X' character, the first file's character in the same position would be replaced by 'X'.

Unfortunately, EDPro does not pass the opposite file name to plug-ins. However, if you want to venture into this we could add such parameter to the next 3.3 Beta build. But please think it through before asking to add this feature.
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

psguru wrote:The way plug-ins work today is as follows: you pass a file name that is about to be compared (there are built-in variables to do this) to a custom application, and that application creates another file based on some rules. The latter file is then used for comparison instead of the original file.

In you situation a plug-in could take two file names (the file itself and the opposite file) and transform the main file into something else based on the contents of the other file. For example, you plug-in could scan lines in both files, and if in the other file there is 'X' character, the first file's character in the same position would be replaced by 'X'.

Unfortunately, EDPro does not pass the opposite file name to plug-ins. However, if you want to venture into this we could add such parameter to the next 3.3 Beta build. But please think it through before asking to add this feature.
Several months have passed, now we bought much more licenses, because more and more people begin to use ExamDiffPro in our company, and now I think this feature would be both helpful and not so complicated to implement. I even began to write such plugin today, but forgot that this is not yet implemented, so I had to stop.

I don't know, if you already thought about implementation, but if not - this could be implemented by duplicating all existing file name macros (such as "$INPUTFILEPATH", etc.) 2 more times:
- $INPUTFILE1PATH (and $INPUTFILE1EXT, etc.)
- $INPUTFILE2PATH (and etc.)
The new macros will serve for two-files plugins, and the old macros will serve for all existing plugins for compatibility purposes.
Later you will be able to add similar support for 3-files comparison cases.

Though there are things that I don't know how to implement. E.g.:
- If it is better to use modifications "1" and "2" in macros' names (as I used above), or "LEFT" and "RIGHT". Though "LEFT" and "RIGHT" will contradict with horizontal variant of splitting.
- What to do when user swaps comparison panels.
- What to do if user requested to show only one panel.
Still I think that it will be easy enough to find solutions' definitions for the above questions.

Thank you.
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

No, there's still no such feature. However, I think we can add to the next build of 3.4 Beta. However, in order to preserve backward compatibility, I'd keep $INPUTFILEPATH and add $SECONDINPUTFILEPATH. I'd also add just one new variable in order to keep the GUI minimal. Given the path, everything else (directory, name, extension) can be derived.
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

psguru wrote:...I think we can add to the next build of 3.4 Beta.
OK.
psguru wrote:However, in order to preserve backward compatibility, I'd keep $INPUTFILEPATH and add $SECONDINPUTFILEPATH. I'd also add just one new variable in order to keep the GUI minimal.
Sorry, may I ask you why adding variables' set that I suggested is worse (I mean "$INPUTFILE2NAME", "$INPUTFILE2PATH", etc.)? I thought they are more consistent with your old variables. And as I suggested, you will certainly leave old variables also supported as is - for compatibility. In addition, I did not understand, how GUI size is related to amount of variables. And in yet addition, what will you do when you will support more than 2 files? Introduce "$THIRDINPUTFILEPATH", etc.?
psguru wrote:Given the path, everything else (directory, name, extension) can be derived.
Yes, you are right. And personally I don't need more currently. But inserting your traditional set of variables seems to me more consistent, and may appear comfortable for other users.

Thank you.
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

Sorry, may I ask you why adding variables' set that I suggested is worse (I mean "$INPUTFILE2NAME", "$INPUTFILE2PATH", etc.)? I thought they are more consistent with your old variables. And as I suggested, you will certainly leave old variables also supported as is - for compatibility.
That's what I'm trying to avoid: multiplying of the number of variable. That's why just adding one name is preferable.
In addition, I did not understand, how GUI size is related to amount of variables.
All variables appear in the Plug-ins Options GUI when you click on the "Select Arguments" button.
And in yet addition, what will you do when you will support more than 2 files? Introduce "$THIRDINPUTFILEPATH", etc.?
Perhaps. 3-way diff is really a long way from were we are today.
But inserting your traditional set of variables seems to me more consistent, and may appear comfortable for other users.
I believe that adding more than the product needs now, especially for such a unique use, is not necessary. Kind of YAGNI.
psguru
PrestoSoft
User avatar
psguru
Site Admin
Posts: 2232
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Post by psguru »

The latest build of 3.4 Beta now includes these variables:

Code: Select all

$INPUTFILEPATH          Full path of the input file
$INPUTFILEDIR           Input file directory
$INPUTFILENAME          Input file name (without directory and extension
$INPUTFILEEXT           Input file extension
$OUTPUTFILE             Full path of the input file
$INPUTFILEPATH_SHORT    Short path of the input file
$INPUTFILENAME_SHORT    Input file's short name
$OPPOSITEFILEPATH       Full path of the opposite file
$TABSIZE                Tab size
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Post by AlexL »

psguru wrote:The latest build of 3.4 Beta now includes these variables:

Code: Select all

$INPUTFILEPATH          Full path of the input file
$INPUTFILEDIR           Input file directory
$INPUTFILENAME          Input file name (without directory and extension
$INPUTFILEEXT           Input file extension
$OUTPUTFILE             Full path of the input file
$INPUTFILEPATH_SHORT    Short path of the input file
$INPUTFILENAME_SHORT    Input file's short name
$OPPOSITEFILEPATH       Full path of the opposite file
$TABSIZE                Tab size
Thanks. I'll try to try it.
Post Reply