No announcement yet.

Grammar - not working as required...

  • Filter
  • Time
  • Show
Clear All
new posts

  • Grammar - not working as required...

    Hi there,

    I'm not good at RegExp so apologies...

    I have two xml files as follows:

    file 1:
    <process:MainProcess xmi:id="_a3oIEP7bEeSTxYPbYBfHpQ" name="XXX010101"
    <elements xmi:type="no:relevant" xmi:id="_a3oIEP7bEeSTxYPbYBfHpQ"

    file 2;
    <process:MainProcess xmi:id="_zDewoBLTEeaBiNEICZdcCA" name="XXX010301"
    <elements xmi:type="no:relevant" xmi:id="_zDewoBLTEeaBiNEICZdcCA"

    I've created a new File Format and a new Grammar Rule as follows:

    [xmi:id="\.23"] Category: Basic RegExp is ticked

    and what I'm looking for is that the strings xmi:id="changingString" to be shown not in blue but black.

    When Session Settings are marked as Importance=Ticked.

    Differences are shown correctly in Red, but the xmi:ids are marked as Red and Blue (not ignored) and
    name="XXX010101 is marked as different from name="XXX010301 with the three in red

    When Session Settings are marked as UnImportant=Unticked.

    Differences everything (xmi:id="changingString") is marked in Blue and
    name="XXX010101 is not marked as different from name="XXX010301, they are both Black when the three should be Red

    If I change the Grammar Rule as follows:

    [xmi:id="\w23"] Category: Basic RegExp is ticked

    the same thing happens.

    So my question is:

    How do I correctly, using the above texts as examples, isolate the only difference as being the 1 and 3 in XXX010101 and XXX010301, ignoring (black) everything in the xmi:id="changingString" ? I don't want any blue...just black and red.

    Many thanks and best regards

  • #2

    If you need a grammar to match only on xml:id" to " and mark it as Unimportant, then mark everything else as Important:
    Create a new grammar, named XMLID, and define it as a Basic =
    With Regular Expression enabled

    This would match on:
    the literal text of xml:id="
    [^"]* 0 ore more Not Quote characters
    the literal "
    This way, the center doesn't grab too much or multiple "'s, and will end on the first " it finds.

    Once defined, XMLID can be marked as Unimportant. Unimportant differences are Blue and are still considered Different until you also enable to the toolbar toggle: Ignore Unimportant Differences.
    The toggle will change any Blue text to Black and treat it as equal for the comparison.
    Aaron P Scooter Software


    • #3
      That worked a treat once I figured out I needed to check Everything Else. Many thanks for this