RegEx to remove XML tags and their content

+1 vote

I would like to remove <bpt *>*</bpt> and <ept *>*</ept>  from the following string without using an XML parser.

The big <bpt i="1" x="1" type="bold"><b></bpt>black<ept i="1"></b></ept> <bpt i="2" x="2" type="ulined"><u></bpt>cat<ept i="2"></u></ept> sleeps.

Any regex in VB.NET or C# will do.

Feb 13 in IoT (Internet of Things) by Upasana
• 8,430 points
43 views

1 answer to this question.

0 votes

I presume you want to drop the tag entirely.

(<bpt .*?>.*?</bpt>)|(<ept .*?>.*?</ept>)

If that is so, then the ? after the * makes it non-greedy, so it will try to match as few characters as possible.

answered Feb 13 by Shubham
• 13,190 points

Related Questions In IoT (Internet of Things)

0 votes
1 answer

How to get Unicast, Dns and Gateway Address in UWP?

Try this code Snippet I found here: https://social.msdn.microsoft.com/Forums/en-US/27a8b7a8-8071-4bc1-bbd4-e7c1fc2bd8d7/windows-10-iot-core-how-do-you-create-a-tcp-server-and-client?forum=WindowsIoT ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
114 views
0 votes
1 answer

How to connect Raspberry Pi and lighting the LED?

You might want to try instead to ...READ MORE

answered Jul 23, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
22 views
0 votes
1 answer
0 votes
1 answer

Device Registration in portable library

No, I don't believe there is. The code ...READ MORE

answered Mar 6 in IoT (Internet of Things) by Shubham
• 13,190 points
12 views
0 votes
1 answer

Configuring a Windows 10 IoT App for Automatic Restart

Have you tried using powershell right after ...READ MORE

answered Oct 10, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
36 views
0 votes
1 answer

Access Serial Ports in Windows 10 IoT App

On Windows IoT you have to use Windows.Devices.SerialCommunication namespace ...READ MORE

answered Oct 10, 2018 in IoT (Internet of Things) by anonymous2
• 4,260 points
51 views
0 votes
1 answer

Problem disposing of socket

If this object is eligible for garbage ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,190 points
27 views
0 votes
1 answer

How to detect presence of a device in a WiFi network?

Finding the mac-address would probably work. Basically, ...READ MORE

answered Nov 16, 2018 in IoT (Internet of Things) by Shubham
• 13,190 points
55 views
0 votes
1 answer

Detecting when a sensor is not sending data to Orion CB in FiWARE

Orion in itself has no such mechanism ...READ MORE

answered Nov 21, 2018 in IoT (Internet of Things) by Shubham
• 13,190 points
25 views