Replace with regular expressions directly, but no judgment Function
Function formatimg (content)
Dim re
Set Re = new Regexp
Re. ignorecase = true
Re. Global = true
Re. pattern = "(SCRIPT )"
Content = Re. Replace (content, "script ")
Re. pattern = "] * SRC (= |) (. [^>] *)>"
Content = Re. replace (content, " ")
Set Re = nothing
Formatimg = content
End Function
This section
Code Replace the image in the content with in the form,
I need to extract the first seven characters of $2 to determine whether to be replaced. If the first seven characters are specified, do not replace them, but cannot get the first seven characters of $2. Do you have any plans?
The following code is used for reference.
'Connection
Re. pattern = "\ [url = (. [^ \] *) \] (. [^ \ [] *) \ [\/url]"
Set strmatchs = Re. Execute (strcontent)
For each strmatch in strmatchs
Tmpstr1 = checkurl (strmatch. submatches (0 ))
Tmpstr2 = strmatch. submatches (1)
Strcontent = Replace (strcontent, strmatch. value, "<a target =" "_ blank" "href =" & tmpstr1 & ""> "& tmpstr2 &" </a> ", 1, -1, 0)
Next
Here is the regular matchs instruction document
Http://www.jb51.net/article/15362.htm
The following code is tested by the script house. You can make a function.
<%
Content2 = " intermediate content Dim re
Set Re = new Regexp
Re. ignorecase = true
Re. Global = true
Re. pattern = "] * SRC (= |) (. [^>] *) [/]?> "
Set matches=re.exe cute (content2)
For each strmatch in matches
Tmpstr1 = (strmatch. submatches (1 ))
Tmpurl = Replace (replace (tmpstr1 ,"'",""),"""","")
// Response. Write left (tmpurl, 20)
If left (tmpurl, 19) = "http://www.jb51.net" then
Picurl = tmpurl
Else
Picurl = "http://img.jb51.net/showpic.asp? Url = "& tmpurl
End if
Content = Replace (content2, strmatch. value, " ")
Next
Response. Write content
Set Re = nothing
%>