Community
    • Login

    Regex to remove text between 2 strings containing < and /> on different lines

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 1.2k Views 1 Watching
    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.
    • Perry BP Offline
      Perry B
      last edited by

      Hi guys,

      I hope someone can help me with this, I think it is a fairly simple expression, but I cannot get it working.

      I want to find and replace all text between 2 strings on different lines.

      The text looks like this:

          <vehicle>
              <component1 position="464.8416 118.8764 -817.1907" rotation="-177.5330 -70.8486 -180.0000"/>
              <configuration name="cover" id="1"/>
              <configuration name="fillVolume" id="1"/>
              <configuration name="wheel" id="1"/>
              <configuration name="fillUnit" id="1"/>
              <configuration name="trailer" id="1"/>
              <boughtConfiguration name="cover" id="1"/>
              <boughtConfiguration name="fillVolume" id="1"/>
              <boughtConfiguration name="wheel" id="1"/>
              <boughtConfiguration name="fillUnit" id="1"/>
              <boughtConfiguration name="trailer" id="1"/>
              <attacherJoints comboDirection="-1"/>
              <fillUnit>
                  <unit index="1" fillType="UNKNOWN" fillLevel="0.000000"/>
              </fillUnit>
              <cover state="0"/>
          </vehicle>
      

      All I want to do is remove everything between the <vehicle> and </vehicle> tags.
      I think the issue is with trying to escape the < and />

      Thanks for any help!

      1 Reply Last reply Reply Quote 0
      • Perry BP Offline
        Perry B
        last edited by

        Correction, I want to remove the tags also.

        Alan KilbornA 1 Reply Last reply Reply Quote 0
        • Alan KilbornA Offline
          Alan Kilborn @Perry B
          last edited by

          @Perry-B

          It seems like this regex will match your text: (?s)^\h+?<vehicle>.*?</vehicle>\R

          1 Reply Last reply Reply Quote 3

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors