Community
    • Login

    Find & Replace sets of value with an unique of values

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    5 Posts 2 Posters 546 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Luigi Giuseppe De FranceschiL
      Luigi Giuseppe De Franceschi
      last edited by

      Hi all!

      in a mine XML i have to replace these lines (example):
      <relationship identifier=“id-742789” source=“id-830939” target=“id-830997” xsi:type=“Composition”>
      <name xml:lang=“en”></name>
      </relationship>
      <relationship identifier=“id-830947” source=“id-830939” target=“id-830948” xsi:type=“Composition”>
      <name xml:lang=“en”></name>

      with this:
      <relationship identifier=“id-999999” source=“id-830939” target=“id-830997” xsi:type=“Composition”>
      <name xml:lang=“en”></name>
      </relationship>
      <relationship identifier=“id-999999” source=“id-830939” target=“id-830948” xsi:type=“Composition”>
      <name xml:lang=“en”></name>

      and after, starting from here:
      <connection identifier=“id-742788” xsi:type=“Relationship” relationshipRef=“id-742789” source=“id-742790” target=“id-742779”>
      <style lineWidth=“1”>
      <fillColor r=“0” g=“176” b=“80” a=“100”/>
      <lineColor r=“0” g=“176” b=“80” a=“100”/>
      <font name=“Sky Text” size=“10” style=“plain”>
      <color r=“0” g=“0” b=“0” a=“100”/>
      </font>
      </style>
      <sourceAttachment x=“540” y=“333”/>
      <bendpoint x=“540” y=“487”/>
      <targetAttachment x=“667” y=“487”/>
      </connection>

      with:
      <connection identifier=“id-742788” xsi:type=“Relationship” relationshipRef=“id-999999” source=“id-742790” target=“id-742779”>
      <style lineWidth=“1”>
      <fillColor r=“0” g=“176” b=“80” a=“100”/>
      <lineColor r=“0” g=“176” b=“80” a=“100”/>
      <font name=“Sky Text” size=“10” style=“plain”>
      <color r=“0” g=“0” b=“0” a=“100”/>
      </font>
      </style>
      <sourceAttachment x=“540” y=“333”/>
      <bendpoint x=“540” y=“487”/>
      <targetAttachment x=“667” y=“487”/>
      </connection>

      How i can do that?

      Best

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Luigi Giuseppe De Franceschi
        last edited by

        @luigi-giuseppe-de-franceschi

        Probably THIS helps you.

        Luigi Giuseppe De FranceschiL 1 Reply Last reply Reply Quote 0
        • Luigi Giuseppe De FranceschiL
          Luigi Giuseppe De Franceschi @Alan Kilborn
          last edited by

          @alan-kilborn thank you, i also looked here but in twice links doesn’t modify inside a tag but only btw brackets :(

          Alan KilbornA 1 Reply Last reply Reply Quote 0
          • Alan KilbornA
            Alan Kilborn @Luigi Giuseppe De Franceschi
            last edited by

            @luigi-giuseppe-de-franceschi said in Find & Replace sets of value with an unique of values:

            i also looked here

            Yes, that is better than my link.

            but in twice links doesn’t modify inside a tag but only btw bracket

            Not sure what that means…

            In fact, now I’m unclear on what exactly you need to do, so I’ll let someone else who does understand jump in and help.

            Luigi Giuseppe De FranceschiL 1 Reply Last reply Reply Quote 0
            • Luigi Giuseppe De FranceschiL
              Luigi Giuseppe De Franceschi @Alan Kilborn
              last edited by Luigi Giuseppe De Franceschi

              @alan-kilborn no problem :)

              i applied a brute force approach and now i hope my xml will work:

              step 1) find <relationship and replace with <relationship>FYY ( *
              step 2) find source and replace with ) source *
              Step 3) find (?-s)(?-i:<relationship>|(?!\A)\G).?\K(?:\x20(.+?))
              with identifier=“id-999999”
              Step 4) find >FYY and replace with " "
              Step 5) find <connection and replace with <connection>FYY
              Step 6) find relationshipRef and replace with ( relationshipRef
              Step 7) find (?-s)(?-i:<connection>|(?!\A)\G).?\K(?:\x20(.+?))
              and replace with relationshipRef=“id-999999”
              Step 8) find >FYY and replace with " "
              Step 9) find ) source and replace with source

              am i mad? :D

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors