Ignore time?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • macandrice
    Journeyman
    • Mar 2016
    • 14

    Ignore time?

    I have two files that, for the most part, only differ in the timestamp on each line. I want to eliminate the time as differences, so I can see the "real" differences.

    I tried this by editing Session/Session Settings/Replacements. I created one regex replacement that replaced
    Code:
    [COLOR=#000000][FONT=Lucida Grande][0-9][0-9]:[0-9][0-9]:[0-9][0-9] *[AP]M[/FONT][/COLOR]
    with a space, with the Left button checked.

    I then duplicated that replacement, this time with the Right button checked. The net result is I have two identical replacements, one for the Left, one for the Right, both of which are replacing times with spaces. (I did a Find using the above regex to make sure that it was matching the times, which it is.)

    I thought that would replace the time on both sides with a space, which would then not be a difference.

    I'm not sure what it's doing, but it's not that. Each line with a time stamp (most of them) is still showing as a difference, and the time itself is in different colors, so it appears that the replacements aren't working.

    So, if this can be done, how does one do it?
    And if it can't be done, please consider it an enhancement request.

    Thanks!

    After some further investigation:
    I still didn't get the above to work, but I did get a generic text replacement to work (I was just confirming I understand how this was supposed to work), but the difference still showed up. After some further stumbling around, I found that "Ignore Unimportant differences" would hide the replacement differences. The Help needs to state this explicitly on the Replacements page, and, preferably, the Importance page.
    After I stumbled upon the View item, I noticed that the wording of the Replacements page says "… that should be considered unimportant," but even if I had seen it, I wouldn't have associated that with the Importance tab. Help is for people who aren't familiar with the intricacies of a program, not for those who are. It should explicitly say something like, "Once replacement(s) are created, use View/Ignore Unimportant Differences to hide replacement differences."
    In addition, I would think "Replacements" should be a checkbox item on the Importance tab, so we can select them separately from the rest of the "important" items.
    Last edited by macandrice; 08-Aug-2017, 04:49 PM.
  • macandrice
    Journeyman
    • Mar 2016
    • 14

    #2
    Anyone?

    Comment

    • Aaron
      Team Scooter
      • Oct 2007
      • 15997

      #3
      Hello,

      To help out: Replacements are designed to mark a specific change as Unimportant, such as "apples" on the left file to "oranges" on the right. It doesn't replace Left's "apples" with "space" and Right's "bananas" with "space", making both "spaces" equal.

      To generally define the Timestamp as a concept, then mark that grammar as Unimportant, you'd use our File Formats, Grammars, and the Session Settings to make the grammar unimportant. We have a guide and video on that workflow, here:
      http://www.scootersoftware.com/suppo..._unimportantv3
      Aaron P Scooter Software

      Comment

      • macandrice
        Journeyman
        • Mar 2016
        • 14

        #4
        Your statement of what they do ("mark a specific change as unimportant") is exactly what I want to do — I want a time change to be unimportant. I don't see anything in the description of Replacements that would indicate I can't do that with them. In fact, that looks like exactly the right place to do what I want to do.

        So, general statement: Replacements need a lot more description in the help, along with some concrete examples (including regexes).

        Moving on, the description of Replacements in Help says, "Replacements identify repetitive changes that should be considered unimportant. You can specify the text to match on one side and the text that replaces it on the other side."

        Further, the Replacement window has a "Replace with" boxes. What is the "Replace with" for if it's not replacing the found text with the "Replace with" text?

        In short, how exactly does Replacements work? Can you give a couple of concrete examples, using regexes, including some regex replacement expressions in the "Replace with"?

        (I understand Grammar. I want to understand Replacements.)

        Thanks!

        Comment

        • Aaron
          Team Scooter
          • Oct 2007
          • 15997

          #5
          Hello,

          Replacements are used for a specific change between left and right. For example, if a function name changed. This can define a Replacement rule to ignore only that very specific change, but marking that text as Important if it is different in any other way. For example, if a user did a Find/Replace on a file, and then you need to compare the original file to the replaced file and only want to ignore that very specific replacement.

          So a quick example of replacements would be function() = execute() for the left vs. right:
          a.function() = a.execute()

          but in a scenario where you'd want to find any time a.function() or a.execute() is different in any other way (such as aligned a.function = a.otherfunction(), or a.function() = nothing, to both be important differences).
          If a.function or a.execute was defined as a Grammar/Unimportant, then it would be Unimportant in *all* scenarios, no matter what it aligned to.
          Aaron P Scooter Software

          Comment

          • macandrice
            Journeyman
            • Mar 2016
            • 14

            #6
            Thanks for the reply, but it doesn't really address any of the questions I asked.

            The screen has "Replace with". What is that replacement for it's not … a replacement? What does "replace" mean in this context if it doesn't mean what the word actually means? Does it mean "text to find on the other side"? If so, then that's what it should say, because "Replace with" is causing all manner of confusion.

            Regexes can be used both in the text to find and in the replacement, so that's more than just a "simple change". In fact, it could cover your "function = otherfunction" example. Your example implies that the purpose is to ignore when X has been changed to Y. But if both X and Y can be regexes, then I again don't see why that can't be applied to anything that can be matched by a regex, including times.

            Maybe this would help — what is actually happening in the comparison engine as a result of a replacement? What is it doing with the "text to find" and the "replace with"?

            Again, it would help (I think) if you would please provide a couple of specific examples using regexes in both the text to find and in the Replace With.

            Thanks for your continued understanding.

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 15997

              #7
              Hello,

              The replacement only marks it as unimportant if the defined Left and Right are aligned (including character by character). The View menu -> Alignment details shows which characters are aligned to which on both sides, and if the Left mask is aligned to the Right, then it can mark this specific difference as Unimportant. The replacement is doing very little on it's own; it's the last step to ignore a specific change that is already compared and aligned.

              Regexs cannot be used on both sides. The dropdown to the right of the Text to Find textbox is a fairly full list of RegEx, but the Replace With text box only supports a small subset of Tagged Expressions. The replacement is explicit and does not support general masking.

              An example is a variable name was altered. The Left file is the older history versus the Right file which has the new name. The nearly entire file is now marked as different since this variable name is everywhere, making the diff view hard to read. You want to ignore this specific change. However, locations where the variable name was deleted still need to be found. A Text Replacement allows you to ignore only the change in the name, while Grammar/Unimportance would mark it as entirely unimportant and miss the deletion.
              Aaron P Scooter Software

              Comment

              • macandrice
                Journeyman
                • Mar 2016
                • 14

                #8
                Thanks; that might be one step forward, but it raised more questions. (This is one of those conversations that would take three minutes in person and forever when not.)

                I don't understand what alignment has to do with anything. If it's not aligned, there is another difference than the one I'm trying to replace. I don't care about those. I only care about this replacement. By definition, the lines are identical except for the time stamp.

                And, again, your example doesn't use regex. As I mentioned way back in my first email, I get the replacement of "this" for "that". That isn't the question here. The issue is the use of regexes in the "text to find" and the ability to use, among other things, regex replacement expressions in the "replace with".

                And, you still haven't answered this question (which I'm expounding on here):
                What does "Replace with" mean? What is done with the Replace With? You say it doesn't mean "replace" (in spite of it using that word), so what does it mean? "Text to find" seems clear — it specifies what text to find on the left-hand side (let's assume left-hand-button is checked). If "Replace with" doesn't mean "replace the 'text to find' with this", then what does it mean? Speak slowly. Use small words. (Sorry, blatant Princess Bride reference.)

                If the answer to that question isn't the key to understanding this, the lack of one is at the very least preventing me from understanding this.

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 15997

                  #9
                  You asked how the Replacement engine was working. I was hoping to clarify that the Replacement part is only coming into play at the very end, after everything is aligned and compared the Replacement can ignore a very specific aligned change.

                  For a RegEx including example, how about variable-with-postfixes = variable with:
                  (.*)-with-postfixes.ext
                  =
                  $1.ext

                  Or a specific subset of variable where instead of .* it matches on something more specific. This wouldn't work with timestamps unless the Replace With Timestamp is static or a tagged expression ($1, $2, etc), such as
                  (\d\d):\d\d:\d\d
                  =
                  $1:00:00

                  Replace means something in the *file* was replaced. Like the earlier example I mentioned where you performed a Find/Replace on the file, and replaced every "Word" with "NewWord". Then, let's say you have another coworker continue to edit Word files while you edit NewWord files. Now, you need to compare this other user's file, a newer version that still uses Word, with your newer version that uses NewWord. You need to find all the changes but this one Word has been completely replaced throughout the file and would show a lot of differences you want to ignore. You can use a Text Replacement to ignore this very specific difference, while still finding any differences where the Word was used differently. It's useful for merging different, divergent files, but isn't useful for handling grammar concepts, where the concept itself (timestamp) is what is unimportant regardless of how/where it appears.
                  Aaron P Scooter Software

                  Comment

                  Working...