How to use automatch rule |
|
This feature will be useful if you need to align lines which are not same, but have some common key value. If you have used ManualMatch command before, you will
easily understand it - Automatch does the same, but (guess what?) automatically.
How to use Automatch?
- Open page. Select RegExp Editor.
- Specify an ordinary RegExp rule to extract key substring
- Make sure to specify AutoMatch rule in actions list
- Compare It! will now apply newly created rule for all (or specified) file types.
How does it work?
Of course, you will hardly need this feature if you work with regular text files.
AutoMatch can be invaluable for users working with log files of all kinds.
Consider these sample log files, each including 2 fields - key and value. Direct comparison with Compare It!
does not give us a lot of information:
1 | BET31504 18777363 |
1 | BET31504 18777363 |
2 | BET31505 2202243 | 2 | BET31604 20408402 |
3 | BET31512 20442342 | 3 | BET31605 239734098 |
4 | BET31590 1025225 | 4 | BET31655 234603354 |
5 | BET31604 10301323 | 5 | BET32112 2003351 |
6 | BET31605 14074122 | 6 | BET35004 26933456 |
7 | BET31637 22712412 | 7 | BET40104 23113562 |
8 | BET31690 10255672 | 8 | BET41204 2463335471 |
9 | BET32004 5266356 | 9 | BET60505 30461244 |
10 | BET32037 40672534 | | |
11 | BET32112 199323523 | | |
12 | BET32547 4562235 | | |
13 | BET60505 304623523 | | |
Let's press F4 to invoke Partial Matching, now result is a bit better, but still the problem is obvious -
application does not know anything about text structure, so it simply tries to match longer text. In some cases this would be enough (check lines #6, #13 in left file):
1 | BET31504 18777363 |
1 | BET31504 18777363 |
2 | BET31505 2202243 | | |
3 | BET31512 20442342 | 2 | BET31604 20408402 |
4 | BET31590 1025225 | | |
5 | BET31604 10301323 | | |
6 | BET31605 14074122 | 3 | BET31605 239734098 |
7 | BET31637 22712412 | 4 | BET31655 234603354 |
8 | BET31690 10255672 | 5 | BET32112 2003351 |
9 | BET32004 5266356 | 6 | BET35004 26933456 |
10 | BET32037 40672534 | 7 | BET40104 23113562 |
11 | BET32112 199323523 | 8 | BET41204 2463335471 |
12 | BET32547 4562235 | | |
13 | BET60505 304623523 | 9 | BET60505 30461244 |
So, let's tell Compare It! what is important for us in these files. We create a regExp with R1=^\w*, which matches first word of each line.
Set action to AutoMatch rule, and see what we have after rescan:
1 | BET31504 18777363 |
1 | BET31504 18777363 |
2 | BET31505 2202243 | | |
3 | BET31512 20442342 | | |
4 | BET31590 1025225 | | |
5 | BET31604 10301323 | 2 | BET31604 20408402 |
6 | BET31605 14074122 | 3 | BET31605 239734098 |
7 | BET31637 22712412 | 4 | BET31655 234603354 |
8 | BET31690 10255672 | | |
9 | BET32004 5266356 | | |
10 | BET32037 40672534 | | |
11 | BET32112 199323523 | 5 | BET32112 2003351 |
12 | BET32547 4562235 | 6 | BET35004 26933456 |
| | 7 | BET40104 23113562 |
| | 8 | BET41204 2463335471 |
13 | BET60505 304623523 | 9 | BET60505 30461244 |
Using Automatch with "Never align" option
Situation when Automatch rule is used along with "Never align mismatches" option, is handled in special way - only rule-matched lines are
aligned to each other, all other differences are separated.
|