Announcement

Collapse
No announcement yet.

Replacement item

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

  • Replacement item

    Hello,

    I need help in replacement item.
    How can I set unimportant a line containing a particular text?
    For example:

    line in file a)
    CenteredPrint((BYTE *)desc[Lang].String);

    line in file b)
    CenteredPrint((BYTE *)desc);

    The difference between line in file a) containing the string [Lang].String and line in file b) has to be considered unimportant.


    Thank you

  • #2
    Hello,

    There are a couple of ways to tackle this. Would the text "[Lang].String" always be considered unimportant? You could define a basic Grammar that matches on this text, then mark it as Unimportant, regardless of where it is or what it aligns to.
    We have a KB article and video that goes into detail here:
    http://www.scootersoftware.com/suppo..._unimportantv3

    Given this one example, this is the method I'd recommend.

    To use a replacement, you can define a Find text to match on the left side (with Lang.String), and then match on the right side without it, such as this RegEx:
    (.*)\[Lang\]\.String(.*)
    =
    $1$2

    A replacement allows you to be more specific, and only ignore this type of difference when it appears in this exact pattern, or in specific text:
    CenteredPrint((BYTE *)desc[Lang].String);
    =
    CenteredPrint((BYTE *)desc);

    Let us know if you have any questions.
    Aaron P Scooter Software

    Comment


    • #3
      Replacement

      Thank you for your help.

      I found some more complicated lines containing the string I sent yesterday.

      The following are two more complicated examples I found in the code:

      line in file a)
      *psr2 = (BYTE)(strlen(desc[Lang].String) + 0x20);

      line in file b)
      *psr2 = (BYTE)(strlen((const char*)desc) + 0x20);

      ================================================== =======

      line in file a)
      memcpy(psr2 + 1, desc[Lang].String, strlen(desc[Lang].String));

      line in file b)
      memcpy(psr2 + 1, &desc, strlen(desc));


      The string [Lang].String can be everywhere in the line and more times.


      Thank you

      Comment


      • #4
        Hello,

        If [Lang].String can appear anywhere within the line, does it always have desc preceeding it? The replacement could be:
        desc[Lang].String
        =
        desc

        Otherwise, you would want to use the Unimportant Grammar method I mention, including the link to the KB article and video walkthrough.

        Would this type of unimportance definition meet your needs?
        Aaron P Scooter Software

        Comment


        • #5
          Hello,

          the name that precedes [Lang].String is a message string so it changes depending on the program interface state. If I use unimportant grammar the line containing [Lang].String is marked as unimportant but remains the different with the corresponding line in the second file. My aim is market both the lines as unimportant in order to ignore the unimportant differences so next difference doesn't match the lines.

          Thank you

          Comment


          • #6
            Hello,

            While "desc" might change, would it be arbitrarily different on the left and right side?

            The grammar or replacement defined must contain all of the text that you want to mark as unimportant. Would a definition that grabs the entire line work? (.*)\[Lang\]\.String(.*)

            If not, specifically which part should it grab up to and how could we know to include only that section?
            Aaron P Scooter Software

            Comment

            Working...
            X