WinMergeX Line Transformations

Line Transformations are a way to normalize input data files on the fly.

To consider an example, we are comparing many data dumps, and some of them use US-style dates (eg, 3/14/2005), and others use (ISO) standard dates (eg, 2005-03-14).

We want to see these lines compare as equal:

LeftRight
3/14/2005: $14002005-03-14: $1400

but these lines compare as different:

LeftRight
3/14/2005: $14002005-03-14: $1500

To solve this problem using WinMergeX, we must use Line Transformations.

The main portion of the actual mechanical process that occurs is the line transformation engine testing a regular expression such as this "(\d)/(\d\d)/(\d\d\d\d)" against a line, and when it matches, doing a substitution with replacement of captured substrings, like this: "{$3}-0{$1}-{$2}".

Here we captured the three parts of a US-date, reordered them, and added a leading zero to the one-digit day number. (In the actual sample line transform file above, four substitutions were used, to handle both one and two digit months and both one and two digit day numbers.)

Home

SourceForge.net logo

Valid HTML 4.01 Transitional