SoFunction
Updated on 2025-04-06

Regular expressions easily eliminate HTML code

1. Clear the Javascript code in the content
Copy the codeThe code is as follows:

Function ClearJSCode(originCode)
Dim reg
set reg = New RegExp
= "<SCRIPT[^<]*</SCRIPT>"
= True
= True
clearJSCode = (originCode, "")
End Function

2. Clear HTML code in the content 
Copy the codeThe code is as follows:

Function ClearHTMLCode(originCode)
Dim reg
set reg = new RegExp
= "<[^>]*>"
= True
= True
ClearHTMLCode = (originCode, "")
End Function

Nowadays, the content of many websites is generated using the collection program. Using the above code, you can easily remove the HTML and JS code in the content.