Search code examples
beyondcompare4

How to correctly enter differences to be ignored by Beyond Compare


I have found this post on how to add rules to a certain or self specified file types to enable ignoring certain differences. I don't seem to understand how it works exactly and I couldn't find anything helping on the web.

Consider the following example: I have an XML document in which <abc attr="foo">content</abc> and <xyz attr="foo">content</xyz> are matched as a different. I want to ignore this difference since it is unimportant. I go to Session > Session Settings switch to Importance Tab and click on Edit Grammar... (all on my desired file format derived from XML format I created and selected previously). I then add a new Rule using New.... I choose Text Matching and check Match character case as well as Regular expression. I tried several different versions for this rule:

  • <abc.*
  • (<abc|<xyz).*
  • <abc.*|<xyz.*

I also tried to add two rules with settings mentioned above where one matched on <abc.* and the other on <xyz.*.

But none of these rules worked. I unchecked the rule(s) on Session Settings and let Beyond Compare ignore unimportant differences but the lines I expected to vanish from the diff now didn't disappear. They persisted and I don't seem to be able to get rid of them.

What am I doing wrong? How do I make this work properly?


Solution

  • Ahh, I found the solution. The correct rule is:

    <(abc|xyz) attr="foo">content</(abc|xyz)>