Finding lines with different words between tags

Finding lines with different words between tags

7
NewbieNewbie
7

    Oct 02, 2011#1

    Hi,

    In a large txt file I'm unsuccessfully trying to find lines, that contain different words between tags <tag1></tag1> and <tag2></tag2>.

    Example:

    <tag1>abc</tag1><tag2>abc</tag2>
    <tag1>def</tag1><tag2>def</tag2>
    <tag1>xxx</tag1><tag2>ccc</tag2>

    In this example only <tag1>xxx</tag1><tag2>ccc</tag2> line should be matched. Please help.

    Best regards,
    Greg

    6,687586
    Grand MasterGrand Master
    6,687586

      Oct 02, 2011#2

      What about searching with Perl regular expression engine for <tag1>(.*)</tag1><tag2>\1</tag2> with using button Hide Lines. That hides all lines containing the same string between both tags and the remaining lines are those with different strings between the two tags.

      7
      NewbieNewbie
      7

        Oct 02, 2011#3

        I can't believe it's so simple.
        Thanks a lot!!!

        236
        MasterMaster
        236

          Oct 09, 2011#4

          Another way would be to search for

          Code: Select all

          <tag1>(.*?)</tag1><tag2>(?!\1).*</tag2>
          This matches pairs of tag1/tag2 tags that don't have the same content.