Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove span using VBScript regex

Tags:

regex

vbscript

How do I remove a span tag using a VBScript regex? For example, the following HTML should be reduced to just the h3 opening tag:

<h3><span style="color: inherit; font-size: 24px; line-height: 1.1;">

It must be by regex, as it is part of a regex process to standardize text. The content of the span can vary totally, and most of the time there is no span.

like image 746
Paul Avatar asked Jun 20 '26 12:06

Paul


1 Answers

You should be able to use the pattern <span [^>]*> to match the opening tag (<span) and then grab everything up to the closing >.

Dim s
s = "<h3><span style=""color: inherit; font-size: 24px; line-height: 1.1;"">"

With New RegExp
    .Pattern = "<span [^>]*>"
    s = .Replace(s, "")
End With
like image 148
Bond Avatar answered Jun 23 '26 04:06

Bond



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!