The filtering of input content in normal ASP is only the replacement of the HTML source code of the left and right angle brackets, so the left and right angle brackets are displayed on the page instead of executing the angle brackets as HTML tags.
Of course, this should be a normal filtering method, and there is another ultimate way to filter HTML tags, which is to replace a pair of angle brackets and all the characters in the angle brackets and not display them. This method must describe the content of the angle brackets in the content. Too much filtering.
However, when it is necessary to replace all the contents in angle brackets, it is obvious that regularization is required. There are two codes, the first one is as follows:
Copy the code as follows:Function nohtml(str)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern=(/<.[^/<]*/>)
str=re.replace( str,)
re.Pattern=(/<//[^/<]*/>)
str=re.replace(str,)
nohtml=str
set re=nothing
End Function
Second type:
Copy the code The code is as follows:
Function nohtml (str)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern=<(.[^>]*)>
str=re.replace(str,)
nohtml=str
set re=nothing
End Function