No announcement yet.

How to flag a string even if both sides of the compare have it

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to flag a string even if both sides of the compare have it

    I use this tool to compare documents. Sometimes due to conversion from a pdf it replaces commas with periods. I wrote a regex to find the string but it only works when it isnt on both documents. Is there a way to have it still be flagged even if it appears on both documents?

  • #2

    Could you expand on what you mean where "it only works when it isn't on both documents"? Defining a grammar element defines a concept, but can then be Important or Unimportant. Two Unimportant elements aligned left to right would be Unimportant (if either is Important, then that text would be Important).

    Text Replacements is a different regex definition. This defines a specific change (apples = bananas), and then only when this change is aligned would it be Unimportant.

    Which type of these behaviors are you trying to implement?

    Is your string change aligned (left to right) on the same line? Alignment is controlled in the Session Settings. Once the pair is aligned, you can then apply the strategies above.
    Aaron P Scooter Software


    • #3
      Basically I want to be able to find a common mistake on the form even when they are perfectly aligned. For example if the left and right both say "apple. banana" I want it to still be highlighted because it should be "apple, banana"


      • #4
        The difference between . and , would be marked as a difference.

        This is, unless, you have a larger element defined as " to ", that swallows everything inside. In that case, then the importance would be determined by the larger, swallowing grammar element, and if that element were Unimportant then the entire defined contents would be unimportant.

        BC4 does not have a conditional definition; you would need to define another grammar element that is
        to explicitly define the total element.
        Aaron P Scooter Software


        • #5
          I understand that. I am saying that if both sides have that mistake. so if both left and right have the period instead of the comma for it to still catch it. like it is not a difference, just a thing I am trying to look out for.


          • #6
            I created two folders, in both of them I created two files, one (errore) with "apple. banana" and one (good) with "apple, banana".
            In "Session Settings" "Other Filters" I have been able to choose NOT to display files that do NOT contain "apple. banana".
            And it seems to work.
            You can see errore files because they contain "apple. banana".
            And You can see good files because I have chosen to suppress filters, so that You can see all files.
            I do not know if this can be adapted to work with regular exceptions.


            Rodolfo Giovanninetti

            Click image for larger version

Name:	AppleBanana.PNG
Views:	51
Size:	59.5 KB
ID:	82358


            • #7
              Ah, I see. Sorry, no, if the text is equal then it is flagged as Equal. Show Same can be set to show all equal lines, which would include it, but not directly navigate it.

              It's on our wishlist to define a Text Replacement (. = ,) and then mark instances where it isn't met as differences, which would probably be the closest method for tackling this type of workflow. Our wishlist is not currently scheduled development, but a place our developers go for ideas for future features and enhancements.

              One complex workaround may be to clone your existing File Format, and set the Left side to use one format, and the Right side to use the clone. Then define a grammar element to match on the left structure "apple, banana" and in the clone format create a new element that is also "apple, banana" but give this element a New/Different name. Differences in grammar element are marked as differences, so by using two formats with different element names, these elements will be marked as a difference even if the text itself is the same.
              Aaron P Scooter Software


              • #8
                I actually stumbled upon a solution. Once I added a regex for what I wanted to catch to the grammar as a string, I was able to alter the coloring of the string to green and add a neon green background making it stand out even when it isn't a difference
                Click image for larger version

Name:	regex_bc_1.PNG
Views:	52
Size:	2.4 KB
ID:	82372
                Click image for larger version

Name:	regex_bc_2.PNG
Views:	36
Size:	1.2 KB
ID:	82373
                Click image for larger version

Name:	regex_bc_3.PNG
Views:	36
Size:	22.0 KB
ID:	82374