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



  • 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!



  • Correction, I want to remove the tags also.



  • @Perry-B

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


Log in to reply