国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

Asp從一段內(nèi)容中獲取第一張圖片的地址

2019-11-17 04:16:39
字體:
供稿:網(wǎng)友

<%
str="<img src=images/200610261533.jpg><img src=""images/200609151656.jpg""><img src=images/200609051735.JPG>"

response.write(GetImgSrc(str))

function GetImgSrc(str) '取得img 標簽內(nèi)容
    dim tmp
    Set objRegExp = New Regexp
     objRegExp.IgnoreCase = True    '忽略大小寫
     objRegExp.Global = false        '全文搜索 !關(guān)鍵!
     objRegExp.Pattern = "<img (.*?)src=(.[^/[^>]*)(.*?)>"
    Set Matches =objRegExp.Execute(str)
    For Each Match in Matches
         tmp=tmp & Match.Value
    Next
     GetImgSrc=getimgs(tmp)
end function

function getimgs(str)'取得
    Set objRegExp1 = New Regexp
     objRegExp1.IgnoreCase = True    '忽略大小寫
     objRegExp1.Global = True    '全文搜索
    objRegExp1.Pattern = "src/=.+?/.(gif|jpg|png|bmp)"
    set mm=objRegExp1.Execute(str)
    For Each Match1 in mm
         imgsrc=Match1.Value
        '也許存在不能過濾的字符,確保萬一
         imgsrc=replace(imgsrc,"""","")
         imgsrc=replace(imgsrc,"src=","")
         imgsrc=replace(imgsrc,"<","")
         imgsrc=replace(imgsrc,">","")
         imgsrc=replace(imgsrc,"img","")
         imgsrc=replace(imgsrc," ","")
         getimgs=getimgs&imgsrc'把里面的地址串起來備用
    next
end function
%>


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 安新县| 金坛市| 南京市| 库尔勒市| 土默特右旗| 沐川县| 镇原县| 馆陶县| 梓潼县| 庄河市| 丘北县| 新平| 华亭县| 和硕县| 丰都县| 石首市| 湖南省| 随州市| 通道| 荆门市| 襄垣县| 阳新县| 财经| 蓝山县| 溆浦县| 修文县| 东光县| 丰原市| 锡林浩特市| 绵阳市| 增城市| 绥芬河市| 南阳市| 昆山市| 台中县| 涡阳县| 班戈县| 读书| 梅河口市| 莱西市| 南昌市|