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