Use regular expressions to implement pattern picture news. Asp

Source: Internet
Author: User
Regular | regular ' text or specific picture mode display News

function Shownew (content,ntype)

Shownew = ""

if (ntype = 1) Then

Shownew = shownew & "<table width=100% >"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td width=600 style= ' word-break:break-all ' valign=top>" &showpic (content) & "< /TD> "
Shownew = shownew & "</TR>"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td valign=top style= ' Word-break:break-all ' >" &onlyword (Content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "</TABLE>"


ElseIf (ntype = 2) Then


Shownew = shownew & "<table width= ' 100% ' >"

Shownew = shownew & "<TR>"
Shownew = shownew & "<td style= ' Word-break:break-all ' valign=top>" &onlyword (content) & "</TD>"
Shownew = shownew & "</TR>"
Shownew = shownew & "<TR>"
Shownew = shownew & "<td width=600 valign=top style= ' Word-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% style= ' 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=top style= ' Word-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><td style= ' Word-break:break-all ' >" &content& "</td ></tr></table> "
End If

End Function

' Show the extracted picture
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) & "' border= ' 0 ' alt= ' Click here in the new window to browse the picture ' Set mode.
Onlyword=re. Replace (Strng, "")



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.