Beyond Compare - ignore certain text strings?
Asked Answered
A

2

11

Is there a way to specify to ignore specific text? For example I have web files that are often the same execpt for the difference in file paths - local vs. remote paths. So in one file I will have:

http://localhost/mysite.com/index.php

and in the other,

http://www.mysite.com/index.php

Can I specify to ignore any of these strings, and if so, how do I do that?

Antisocial answered 2/3, 2011 at 18:3 Comment(0)
S
17

Using Beyond Compare 3 Pro you can set up a replacement that will ignore changes of one string to a specific other one.

  1. Load the files in the text compare
  2. Selection the Session->Session Settings... command.
  3. Change to the Replacements tab.
  4. Click New...
  5. In the new dialog put http://localhost/mysite.com/ in the Text to find edit and http://www.mysite.com/ in the Replace with edit.
  6. Click Ok.
  7. Change the combobox at the bottom of the dialog from Use for this view only to Use for all files within parent session if you want it to affect everything in the folder compare, or use one of the other options expand or limit the scope. The default option only keeps the settings in effect until you close the text compare.
  8. Click Ok in the original dialog.

You can also right click on differences and use the Replacement command to automate some of the above steps. It tries to pre-fill in what the replacement should be, but doesn't always get it right.

Sogdian answered 2/3, 2011 at 18:39 Comment(1)
If you don't have the pro version, you can use the Grammar settings to ignore a string https://mcmap.net/q/1015134/-how-do-i-make-beyond-compare-ignore-certain-differences-while-comparing-versions-of-delphi-form-filesDiadem
S
5

If you want to ignore something that can't be handled by a replacement because the to-state isn't easily defined such as mismatching page numbers you need to use a regular expression grammer to ignore certain strings.

In my case I needed to ignore Page numbers in a document footer

Here is how to do it:

  1. Load your comparison in Beyond Compare
  2. Click the Rules toolbar button (referee icon).
  3. On the Importance tab, click Edit Grammar.
  4. Click New.
  5. In Text matching enter your regex e.g. "Page\s\d{1,3}\sof\s\d{1,3}"
  6. Tick Regular Expression
  7. Click OK.
  8. Click OK.
  9. Uncheck the element in the Grammer elements list to make it unimportant.
  10. Click OK

Your grammer should now be marked as unimportant (blue text)

Stigmatism answered 28/2, 2017 at 22:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.