Announcement

Collapse
No announcement yet.

Ignoring carriage-return in text compare

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ignoring carriage-return in text compare

    Hi,

    Is it possible to create a regular expression to ignore carriage-return (0x0d) when comparing C++ or C code? Or can anyone help me create one?

    Thanks,

  • #2
    Sorry, it isn't possible to ignore carriage return in the BC3 Text Compare.
    Chris K Scooter Software

    Comment


    • #3
      I found this entry and I thought I'd add something

      I'm using BC to compare "mainframe" files created on the PC. As a result, since these have the concept of "record lengths" and no x'0D0A', I'm used to having to "tell" BC the EXACT length of the file - normally, this isn't a problem, unless ....

      Since many mainframe files can contain packed fields, then a packed value of say 13 might well be represented by the value x'0D'. As a result, when comparing files, a file that contains 'Michael' x'0D' 'Simpson' will be shown in BC as

      Michael
      Simpson

      even though I specified 15 as the characters per line limit. I IMAGINE that the latter is some max value, but as the same time, it doesn't seem to make much sense specifying a specific value if it's ignored as soon as x'0D' is found.

      Is there no work-around (apart from editing the file and changing all x'0D' to something like ยง) ????

      Comment


      • #4
        If you create a custom conversion, you can call it automatically and create temporary files (rather than actually editing your files) for the comparison. This is similar to how we compare MS Word files: by temporarily creating a plain text file for the comparison.

        http://www.scootersoftware.com/suppo...conversion.php
        Aaron P Scooter Software

        Comment


        • #5
          Originally posted by Chris View Post
          Sorry, it isn't possible to ignore carriage return in the BC3 Text Compare.
          Plz fix, k? Thx.

          Okay, that's trite, so... Most programming languages treat the newline as just another whitespace - why should our comparison tool be any different?

          Comment


          • #6
            nklatt,

            Thanks for the suggestion. Comparing across newline or ignoring newline is on our wish list for a future version.
            Chris K Scooter Software

            Comment


            • #7
              Thanks Aaron for the suggestion

              Since I don't write C/C++ I threw together a program in Rexx instead. Worked like a charm !!!

              Out of interest - I like to put up a quick windows message to the user indicating that something is happening. This "tells" the user that they're using the correct conversion routines so if they DO see any differences, they know it has nothing to do with CR or LF. One point though - is there any way of knowing WHICH file is being converted ? I would like to be able to put out a message similar to

              "Converting file n" (where n obviously is either left/right or 1/2).

              Any way of knowing this or will I have to create generic message ???

              Comment


              • #8
                %s and %t are temp files, but you can obtain the original file name using the %n variable to use in your "converting file" message.

                It isn't possible to determine if a file is left or right, number 1 or 2 when calling a conversion tool from BC.
                Chris K Scooter Software

                Comment


                • #9
                  how is that wish list coming along?

                  it sure would be nice to not be bothered by differences caused by people adding carriage returns to wrap function signatures into their viewable area...

                  Comment


                  • #10
                    robwafle,

                    Marking carriage return differences unimportant is still on our wish list for a future release of Beyond Compare.
                    Chris K Scooter Software

                    Comment


                    • #11
                      +1 for marking carriage return differences unimportant.

                      Comment


                      • #12
                        Ignoring carriage-return in text compare

                        This would help Immensely. Please make it so in the next revision.

                        Comment


                        • #13
                          Sorry to revive an old thread but +1 on the ignoring carriage returns.

                          My company uses an auto-formatter on Java code which splits function calls accross lines. It would be great to see the actual differences in code other than this reformatting and would make any tool that does this a must buy.

                          Comment


                          • #14
                            Thanks for the interest. Ignoring carriage return differences is still on our wish list for a future version.
                            Chris K Scooter Software

                            Comment


                            • #15
                              I was wondering if this feature has been implemented yet?

                              Comment

                              Working...
                              X