国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 兰西县| 三原县| 清丰县| 海口市| 石家庄市| 泾源县| 正镶白旗| 汉寿县| 九龙城区| 固始县| 张家口市| 徐水县| 铜山县| 衡南县| 宁阳县| 齐河县| 呼图壁县| 日土县| 肇庆市| 称多县| 老河口市| 通辽市| 米易县| 宁夏| 彩票| 临安市| 枣阳市| 天全县| 读书| 北京市| 长寿区| 平山县| 丹棱县| 阳曲县| 乐昌市| 安多县| 东山县| 遵义县| 西和县| 永胜县| 聂拉木县|