Andre
Andre

Reputation: 61

How to use regular expressions in kdiff3 when merging two git files

I was wondering if someone could help me with explanation how to merge two files using regular expressions. I am trying to bring back comments that were removed in one of the branches. The problem is that there are over 600 of them. I tried to set the following expressions in Settings/Merge/Automerge: (/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(//.*) When I click on Test your regular expressions and put an example, it confirms that it works fine. However when I try to run Merge/Run Regular Expressions AutoMerge nothing happens. Any ideas what am I doing wrong?

Upvotes: 2

Views: 299

Answers (1)

Nils Berglund
Nils Berglund

Reputation: 1

As per the documentation

For simple lines that match the "Auto merge regular expression"-option in all input-files KDiff3 will choose the line from B or - if available - from C. (Additionally it is necessary that the lines in question line up in the comparison and the previous line contains no conflict.) This auto merge can either be run immediately after a merge starts (activate the option "Run regular expression auto merge on merge start") or later via the merge menu "Run Regular Expression Auto Merge".

So Kdiff doesn't choose A, B, or C based on that regex, it just identifies the line/block as one that should be automerged. And it chooses B or, if available, C.

Upvotes: 0

Related Questions