使用正则表达式实现模式图片新闻.ASP

网络整理 - 08-16
''文字或特定图片模式显示新闻

function shownew(content,ntype)

shownew = ""

if(ntype = 1) then

shownew = shownew &" <TABLE width=100% >"
shownew = shownew &"<TR>"
shownew = shownew &" <TD width=600word-break:break-all'' valign=top>"&ShowPic(content)&"</TD>"
shownew = shownew &"</TR>"
shownew = shownew &"<TR>"
shownew = shownew &" <TD valign=topword-break:break-all''>"&OnlyWord(content)&"</TD>"
shownew = shownew &"</TR>"
shownew = shownew &"</TABLE>"


elseif (ntype = 2) then


shownew = shownew &" <TABLE100%''>"

shownew = shownew &"<TR>"
shownew = shownew &" <TDword-break:break-all'' valign=top>"&OnlyWord(content)&"</TD>"
shownew = shownew &"</TR>"
shownew = shownew &"<TR>"
shownew = shownew &" <TD width=600 valign=topword-break:break-all''>"&ShowPic(content)&"</TD>"
shownew = shownew &"</TR>"
shownew = shownew &"</TABLE>"

elseif (ntype = 3) then


shownew = shownew &"<TABLE>"

shownew = shownew &"<TR>"
shownew = shownew &"<TD width=100 valign=top>"&ShowPic(content)&"</TD>"

shownew = shownew &"<TD width=80%word-break:break-all'' valign=top>"&OnlyWord(content)&"</TD>"


shownew = shownew &"</TR>"
shownew = shownew &"</TABLE>"

elseif (ntype = 4) then

shownew = shownew &"<TABLE>"

shownew = shownew &"<TR>"

shownew = shownew &"<TD width=80% valign=topword-break:break-all''>"&OnlyWord(content)&"</TD>"
shownew = shownew &"<TD width=100 valign=top>"&ShowPic(content)&"</TD>"

shownew = shownew &"</TR>"
shownew = shownew &"</TABLE>"
else
shownew = shownew & "<table><tr><tdword-break:break-all''>"&content&"</td></tr></table>"
end if

end function

''显示提取的图片
function ShowPic(strng)

ShowPic = ""
ImageUrl= RegExpExecute(strng)

ImageUrls = Split(ImageUrl,"<BR>")

for i = LBound(ImageUrls) to (UBound(ImageUrls) - 1)

ShowPic = ShowPic & ("<a href=''"&ImageUrls(i)&"'' target=_blank><image src=''"&ImageUrls(i)&"''0'' alt=''按此在新窗口浏览图片'' 设置模式。
OnlyWord=re.Replace(strng,"")
Set re= nothing

end function