[closed] Regular Expression (RE)

Post your bug reports here.
Post Reply
Guest

[closed] Regular Expression (RE)

Post by Guest »

We are testing Compare It! for almost 1 year and the new functions that are implemented during that time are very usefull. It makes our lives simple. :)

Now I am testing the RE functions and discoverd that it doesn't always work like it suppose to.

When I use "Ignore string whit match" it ignores the lines only at the beginning or at the end of the file. When I make a search parameter for the lines in between the lines are not ignored. The symbol for RE is visable where the file name is. I couldn't get it working.

:idea: It seems to me that when there are differences before the lines that should be ignored RE is aborted. I think that the problem is here.

Also the "Replace" function won't replace the matches that are found. When I use the Replace in Edit/Replace all the matches are replaced so my search parameter is working.

Does anybody else have the same problem that I encoundered??

I hope that you can fix this soon.

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

Happy New Year! And thank you for your report!
If you could send me some sample files, with examples of what is not working, this would help a lot. In fact quite a lot of people are using this feature without problems, so maybe there is difference between how you and Compare It understand RE usage in comparison context :)

A. Üzümcü

Post by A. Üzümcü »

Happy New Year to you too.

I have the sample files ready. I will also send the ini file to view my settings. What's the mail address where I have to send the files?

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

support-at-grigsoft.com is fine, thank you!

Gerrit

Regular Expression (RE)

Post by Gerrit »

Hi,

It is my experience that sometimes the RE comparisons are not functioning fully correct. I never had the time to report these. I should of course...

Gerrit

Gerrit

Post by Gerrit »

I have this case:

DOC1 ( 3 lines ) --------
This is line 1
COMMENT on line 3
This is line 4
--------


DOC2 ( 4 lines ) --------
This is line 1
COMMENT on line 2
COMMENT on line 3
This is line 4
--------

And I defined a RE with R1 equals 'COMMENT *' and selected 'Ignore string with match'

I can enable and disable 'Ignore inserted empty lines' found under options - comparison (I call this OPTION LINE)
I can enable and disable 'Use Regular Expressions' found under options - comparison (I call this OPTION RE)

What happens next is not always correct:

CASE 1
Both OPTION LINE and OPTION RE are enabled:
Comparison is correct.
Display is incorrect with empty line displayed as line 3 in DOC 1.

CASE 2
Both OPTION LINE and OPTION RE are disabled:
Comparison is correct. Suggest to copy line 2
Display is correct.

CASE 3
OPTION LINE is enabled
OPTION RE is disabled:
Comparison is correct. Suggest to copy line 2
Display is correct.

CASE 4
OPTION LINE is disabled
OPTION RE is enabled:
Comparison is incorrect. Suggest to copy line 3 !
Display is incorrect.

Hope this helps.

Gerrit

A. Üzümcü

Post by A. Üzümcü »

When "ignore string with match" is used does it only ignores it in the source file, or only in the target file, or is it suppose to ignore it in both files?

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

It is supposed to ignore it in both files, of course. I'm studing your samples at the moment, I will let you know.

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

A. Üzümcü,
I have sent you reply in private.
Gerrit,
In fact in your case everything is working as it should.
First, make sure you are using 'CORRECT .*' syntax - note dot (.) before asterix. Just asterix is not correct regexp syntax.
Next, when you use "ignore string with match" rule, string is considered to be empty during copmarison, so don't bsurprised it is aligned with empty line. Also from 2 empty lines it does not matter which one to align, that's why you can have line 3 suggested to copy.

Gerrit

re and empty lines

Post by Gerrit »

Thanks Igor for the work you did. At least we know there is no bug.

But I think you are overlooking something. If I use the RE (corrected to COMMENT .*) and have it enabled as in case 4 (see previous post), then why would Compare It! suggest that I copy that line? It should be ignored, isn't it?

Gerrit

grigsoft
Site Admin
Posts: 1673
Joined: Tue Sep 23, 2003 7:37 pm
Contact:

Post by grigsoft »

In fact I didn't say there is no bug :) I said there is no bug with RegExps :)
Speaking seriously, I know about this issue. In short words, the problem is "Min string length to match" option. If you set it to 0, you will be fine. However if it is not 0, Compare It skip same lines of this length, not letting them break changes block. This is OK, but after changes block is fully identified, such lines should be found within block again and marked as same, which is not done at the moment. But I'm going to fix it in one of nearest updates.

Gerrit

Post by Gerrit »

Hi Igor,

It was meant as a compliment :oops:

In my concept of what is happening I think the problem is related to the fact that Compare It! treads empty lines and RE's that are 'ignored with match' in the same way. They are actually very different things. I would like to see Compare It! compare the full files (including all RE's that user has selected to be ignored) to get as good a match between the two docs as possible. Compare It! should know that the phrase 'COMMENT on line 3' is present in both files. Then it should hide the fact that it knows this nor offer the merging tools for these lines, if the user has RE's active that matches these lines.

Stated very dense: Known when comparing, ignored when reporting.

I missed your point. I set "Min string length to match" option to zero. I also changed the sentence 'COMMENT on line 3' to 'COMMENT on line 33333' and 'COMMENT on line 2' to 'COMMENT on line 22222', but it had no effect. Then I unchecked all comparison options under Options, using only the one RE, it remained suggesting to copy line 3 to DOC1, when actually it should be ignored.

For all readers who do not know Compare It! It is great software! :)

Kind regards,

Gerrit

A. Üzümcü

Post by A. Üzümcü »

Igor,

Thanx for the solution. I think I understand it now. I've got most of the RE working.

Keep up the good work !! 8)

Post Reply