用asp获得内容中的图片与获得内容中的第一个图片地点,首要是PYCMS中保管内容中的图片须要用获得,利用的是正则的方式
'===================================== '获得内容中第一张图片'===================================== Function Frist_Pic(ByVal t0) Frist_Pic="" Dim Regs,Matches Set Regs=New RegExp Regs.Ignorecase=True Regs.Global=True Regs.Pattern="]+src=""([^"">]+)""[^>]*>" Set Matches=Regs.Execute(t0) IF Regs.test(t0) Then Frist_Pic=Matches(0).SubMatches(0) End IF Set Matches=Nothing Set Regs=Nothing End Function
'===================================== '获得内容中一切图片 '===================================== Function Get_ImgSrc(ByVal t0) Dim t1,Regs,Matches,Match t1="" IF Not(IsNull(t0) Or Len(t0)=0) Then Set Regs=New RegExp Regs.Pattern="]+src=""([^"">]+)""[^>]*>" Regs.Ignorecase=True Regs.Global=True Set Matches=Regs.Execute(t0) IF Matches.Count>0 Then For Each Match In Matches IF Left(Match.SubMatches(0),7)<>"http://" Then t1=t1&"