Remove range using VBScript regex

How to remove span tag using VBScript regex? For example, the following HTML code should only be rolled up to a tag h3

:

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

      

It should be using a regex as it is part of the regex process to standardize text. The content span

can change completely, and most of the time it doesn't span

.

+3


source to share


1 answer


You should be able to use a template <span [^>]*>

to match the open tag ( <span

) and then grab everything before the close >

.



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

      

+2


source







All Articles