RegEx to ignore beginning of line

Support for our DiffMerge utility.

Moderator: SourceGear

Posts: 1
Joined: Fri Sep 24, 2010 5:07 pm
PostPosted: Fri Sep 24, 2010 5:17 pm
I am trying to figure out how to ignore the first 4 characters of each line when comparing two files. I know that the 5th character will be a space, so it seems like I should be able to accomplish this by setting the context boundaries in a ruleset, but I can't get it to work. I've tried several RegEx variations, and unchecked the "Classify differences as Important", but nothing works. Any guidance would be appreciated.

Posts: 534
Joined: Tue Jun 05, 2007 11:37 am
Location: SourceGear
PostPosted: Mon Sep 27, 2010 1:39 pm
Sorry, but we don't support ignoring or excluding data by columns.

There are 2 ways to think of this feature:
[1] strip the columns out of the line before comparing them.
(the "ignore whitespace when matching lines" feature does
that, but it only handles whitespace.)
[2] don't strip them in the line-compare phase, but rather use the
"classify differences as important" feature to not color/not-color
them during the drawing phase. (the "hide unimportant differences"
feature does this.)

I'm guessing that you want [1]. I've had several requests to be
able to ignore columns, such as 1-7 and/or 72-80 for Fortran or
Cobol source code.

In fact, you probably want a combination of both [1] and [2] -- that is,
ignore them for in the line-matching (vertical alignment) and then
ignore them again in the coloring/highlight.

Getting the RegEx right to use just [2] is problematic. Using something
with a leading "^", for example doesn't work correctly right now because
of a bug in how I'm resetting the pattern within a line (so that I can
identify the start of multiple comments within a line).

Sorry I don't have a better answer for you right now (and sorry to
make this so complicated (both the code and the description of the

jeff hostetler


Return to Support (DiffMerge)

Who is online

Users browsing this forum: No registered users and 4 guests