• Login
Community
  • Login

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

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
3 Posts 2 Posters 904 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.
  • P
    Perry B
    last edited by May 22, 2020, 6:09 PM

    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
    • P
      Perry B
      last edited by May 22, 2020, 6:13 PM

      Correction, I want to remove the tags also.

      A 1 Reply Last reply May 22, 2020, 6:35 PM Reply Quote 0
      • A
        Alan Kilborn @Perry B
        last edited by May 22, 2020, 6:35 PM

        @Perry-B

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

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