Exact Grammar Match rule

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • grrrrr
    New User
    • Aug 2019
    • 1

    Exact Grammar Match rule

    For a file format, (i.e. Xml) I can define a grammar item in the grammar rules that will effectively ignore a particular unimportant set of text.

    So for example I can tell it that the words "Fred" and "Bob" are not important. And when the comparison happens if Fred and Bob exist as a difference on a particular line they will be ignored..

    Is there an option anywhere to explicitly define "Fred" in File A and "Bob" in file b as an exact diff is unimportant? i.e. Specifically define the text on the left and right to be ignored?


  • Aaron
    Team Scooter
    • Oct 2007
    • 16002

    #2
    Hello,

    Yes, as part of a Text Replacement (Session Setting, instead of a File Format option). This is in the Text Compare's Session menu -> Session Settings, Misc tab, and requires BC4 Pro. If you don't have Pro, you can trial it to make sure it meets your needs before purchase is necessary, following this guide:
    http://www.scootersoftware.com/suppo...?zz=kb_evalpro
    Aaron P Scooter Software

    Comment

    • shapirom
      Visitor
      • Sep 2019
      • 4

      #3
      Hi could you give an example of how to do this, please? I tried doing it for my C# code and couldn't figure out how to get it to work the way I expected it to. In my scenario (similar to the original poster's I think?) To give a specific example:
      For the purposes of my comparison, string.Empty, String.Empty, and "" should not be treated as differences - that is, if File1 has String.Empty and File2 has "", it should not show up as a difference (or should show up as minor, either way works for me). How can I configure a rule for this?

      Comment

      • Aaron
        Team Scooter
        • Oct 2007
        • 16002

        #4
        Hello,

        For the Text Compare's Replacement, first open your file comparison in the Text Compare, go to the Session menu, Session Settings, Replacements tab. Create a new Replacement (+), and define as
        String.Empty
        =
        ""
        as a literal replacement, for this specific change. Click Ok and you should see this change is ignored in your files. You would need a new pair (left vs. right) for each type of change you need to capture.
        Aaron P Scooter Software

        Comment

        • shapirom
          Visitor
          • Sep 2019
          • 4

          #5
          Is there a way to do this with Text Merge (I'm using this for 3-way compare)

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 16002

            #6
            Hello,

            No, Text Replacements are only supported in the 2-way Text Compare session, and not in the 3-way Text Merge session. For a Text Merge, you can globally define grammar elements to match specific text empty.string, or "", and then mark that grammar as Unimportant. This would mark that text as Unimportant regardless of what it aligned to; what it aligned to could also be Unimportant or Important. We have a KB article on defining grammar and marking as Unimportant here (which applies to the Text Compare, and can also be used in the Text Merge session): http://www.scootersoftware.com/suppo..._unimportantv3
            Aaron P Scooter Software

            Comment

            • shapirom
              Visitor
              • Sep 2019
              • 4

              #7
              They're only unimportant with respect to each other - if one file has String.Empty and the other has something else (or nothing), it should still be treated as important.

              Comment

              • Aaron
                Team Scooter
                • Oct 2007
                • 16002

                #8
                In that case, if string.empty were unimportant, the other side could be important or unimportant, depending on its own definition.

                Otherwise, you would need to use the Text Compare to compare one pair, then the other pair, with Replacements defined.
                Aaron P Scooter Software

                Comment

                • shapirom
                  Visitor
                  • Sep 2019
                  • 4

                  #9
                  Right, but let's say the other side is unimportant because of some other, unrelated rule.. For example if I create a rule for "Home" and "House".. then in one file I might have String.Empty and in another file I might have "House" and it wouldn't see that as a difference. It looks like the Replacements definitions in Text Compare might let me do what I need to do, but they're not available in merge..

                  Comparing one pair then the other pair doesn't work, because I need to be able to see all three side by side to evaluate, on a case by case basis, how to resolve the meaningful differences!

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16002

                    #10
                    Hello,

                    If you have sample files you can email us, we can add these to our test cases and see if there's a better workaround. Email us at [email protected] and include a link back to this forum thread in the email. Including a couple of Line Numbers and Text Replacement 'examples' of what kind you need would also help.
                    Aaron P Scooter Software

                    Comment

                    Working...