How to use winmerge line filter?

9,642

Solution 1

I found this post because I was also struggling with WinMerge. The line filter documentation goes right at RegEx, so did I. Stupid me; none of the expressions I made did any filtering. Turns out you just put the string in common to left and right lines and it works like I want.

For example, I am comparing 2 XML files for certain differences. Some lines contain these strings:

IntID IntRef

They are preceded by whitespace, and open tag string and followed by a UUID, which is the entity that is causing a difference I would like to ignore.

So I just added two line filters with just the strings and no RegEx stuff. It was a bit slow to process a 12M file, but I more than made up for the time in having to ignore 1000+ hits to see the 4 differences.

I think this is what you are after with the XXXXXXXX XXXXXXXXX on the left and right. I am assuming the data is the same on each side.

Solution 2

Great answer, KJM! I Would also suggest using the 2011 fork of WinMerge here. It has a nice testing feature in the line filter popup. For your particular case, your regular expression would look something like:

^(XXXXXXXX\sXXXXXXXXX).*$

or

^(XXXXXXXX\sXXXXXXXXX)(\sOPTIOINAL\sXYZ)*$

Check out here for regex examples.

Share:
9,642

Related videos on Youtube

lamwaiman1988
Author by

lamwaiman1988

Updated on September 18, 2022

Comments

  • lamwaiman1988
    lamwaiman1988 almost 2 years

    There are a lot of difference which I am not interested. For example, consider the following case:

    LEFT : XXXXXXXX XXXXXXXXX RIGHT: XXXXXXXX XXXXXXXXX OPTIOINAL XYZ

    I want to ignore this pattern of difference, but I just can make the filter work. Any suggestion?

  • Dan Csharpster
    Dan Csharpster over 9 years
    I've been having good luck with WinMerge's line filtering, also. It took me a while to figure out the expression had to be common. Now I need to figure out how to match collapsed rows of text. It's source code and in many places 2 rows in the source are collapsed to one in the target and I want to ignore this. Any ideas on how to handle multiline issues like this?