ignoring lines with certain content

General questions about using ExamDiff Pro, ideas for new features, bug reports, and usage tips.
Post Reply
BillG
New Member
Posts: 3
Joined: Mon Jun 07, 2010 1:36 pm

ignoring lines with certain content

Post by BillG »

Hi,

I have a situation where I am comparing a bunch of text files and I want to ignore lines containing certain text strings. Also, perhaps ignore the first N lines of the file. I suppose there must be a simple RegEx answer to this, but so far it eludes me. For instance, I want to ignore lines that contain:

"CK SUM:"
"DIRECTORY:"

and possibly another 5 to 10 character strings. Any help greatly appreciated.

TIA,

Bill
User avatar
psguru
Site Admin
Posts: 2231
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: ignoring lines with certain content

Post by psguru »

Hi Bill,
For instance, I want to ignore lines that contain:

"CK SUM:"
"DIRECTORY:"

and possibly another 5 to 10 character strings.
For this purpose you could use a regular expression like:

Code: Select all

CK SUM\:|DIRECTORY\:
To add more strings to the regular expression, simply add the strings (escaping all necessary characters) and separate them all with | operators.
Also, perhaps ignore the first N lines of the file.
Unfortunately, this is not possible with regular expressions.

Regards,

psguru
psguru
PrestoSoft
tofuse
New Member
Posts: 1
Joined: Mon Jun 07, 2010 10:29 pm

Re: ignoring lines with certain content

Post by tofuse »

The problem that you are facing here is that examdiff pro run your regex in line by line mode.
What you are asking for is a multiline functionality where an expression like below would ignore a complete C# documentation tag. This is as stated earlier not possible. If you have multiple rows that you want to ignore you need to ignore them one by one. Unfortunately this means that you can't ignore a line depending on the contents of an earlier line.

^[ \t]*/// <summary>(?:[^/]*/)*?// </summary>[^\n]*\n
BillG
New Member
Posts: 3
Joined: Mon Jun 07, 2010 1:36 pm

Re: ignoring lines with certain content

Post by BillG »

Thanks psguru,

A follow-up detail. I assume the RegEx's go into the Text Comparison Options/Ignore parts of each line?

TIA,

Bill
User avatar
psguru
Site Admin
Posts: 2231
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: ignoring lines with certain content

Post by psguru »

A follow-up detail. I assume the RegEx's go into the Text Comparison Options/Ignore parts of each line?
No, this is for Options | Compare | Ignore lines matching regular expression.
psguru
PrestoSoft
User avatar
psguru
Site Admin
Posts: 2231
Joined: Sat May 15, 2004 4:23 pm
Location: California
Contact:

Re: ignoring lines with certain content

Post by psguru »

tofuse wrote:The problem that you are facing here is that examdiff pro run your regex in line by line mode.
This is actually incorrect. EDPro can use multiline regexes as "comments". See Options | Document Types. There you can define a type with its "comment" to ignore, which is just a multiline regex (can be a single line as a special case, of course).
psguru
PrestoSoft
AlexL
Expert Member
Posts: 129
Joined: Wed Aug 11, 2004 6:25 am
Location: Israel
Contact:

Re: ignoring lines with certain content

Post by AlexL »

BillG wrote:...ignore the first N lines of the file...
For this you should pass your files through a command line Unix-like command:

Code: Select all

tail +3 YourFile.txt
will output your file from line 3 (skipping first two lines). If you manage to organize the command above as a filter (or write such filter in, say, Perl), you will be able to skip first N lines in ExamDiff Pro.
Post Reply