Having troubles ignoring custom unimportant differences in Beyond Compare 3

936 Views Asked by At

Quick preamble

Before you go and mark this as a duplicate of this question, I'm trying this very solution and I'm still having issues.

Question

I'm trying to compare files between two folders of an ASP.Net website using Beyond Compare v3.3. One folder has all the .ascx.cs files defined, and the other inherits the code behind from a dll.

So on the left side, the .ascx files have

<%@ Control Language="c#" Inherits="MyControl" CodeFile="MyControl.ascx.cs" %>

and on the right side, they have

<%@ Control Language="c#" Inherits="MyControl, MyAssembly" %>

If those are the only differences in the file, I want them to be considered equal via the Ignore Unimportant Differences feature.

A quick Google search comes up with this StackOverflow question and this support page, which say basically the same thing.

I've followed their directions, but it's still not working.

Here's what I've done:

  1. Started a new Folder Comparison session.
  2. Opened a .ascx file.
  3. Clicked the Rules button to open the Session Settings dialog.
  4. On the Importance tab, clicked the Edit Grammar button.
  5. Clicked the "New..." button.
  6. Set the "Element name" to "CodeFile", the "Text matching" to

    (Inherits|CodeFile)\s*=\s*(["'])[^'"]+\2

    checked the "Regular expression" checkbox, unchecked the "This element is case sensitive" checkbox, and clicked the OK button.

    New Grammar Item dialog

  7. Clicked the OK button.
  8. (Now back on the Importance tab) Unchecked the newly made "CodeFile" checkbox.
  9. In the dropdown, selected "Update Session Defaults", and clicked OK. Session Settings dialog

Just to double check that my regex is correct, I ran a ctrl+F on the two .ascx files, using the regex. It found all three instances correctly (Inherits="..." on the left file, and Inherits="..." and CodeFile="..." on the right).

Even on the file comparison (as opposed to the folder comparison), it's not marking the differences as unimportant. These particular lines have differences in case, and it is correctly marking those as unimportant, but the CodeFile and Inherits it is still complaining about.

I considered that maybe it's because one side had two differences while the other had one, so I added a comment on one file, which, as I understand it, has the exact same type of rules as my new one. BC3 correctly ignored the comment as well.

Comparison fail

Any ideas?

1

There are 1 best solutions below

0
On

I was having problems ignoring lines with sp_updateextendedproperty or sp_addextendedproperty for SQL files. The soultion I found was to ensure the regex actually matched the whole line not just part of it. Originally I was using: EXEC sp_(update|add)extendedproperty

To resolve the match problem I changed it to be: .*EXEC sp_(update|add)extendedproperty.*

This then includes any prepended or appended characters