1 2 3 4 5 6 7 8 9 10 11 |
Function ImgToAmpImg(ContentStr) Dim ClsTempLoseStr,regEx ClsTempLoseStr = Cstr(ContentStr) Set regEx = New RegExp regEx.Pattern = "<img.*?\ssrc=([\""\'])([^\""\']+?)\1.*?>" regEx.IgnoreCase = True regEx.Global = True ClsTempLoseStr=regEx.replace(ClsTempLoseStr,"<amp-img layout=""responsive"" width=""800"" height=""600"" src=""$2"" srcset=""$2 640w, $2 320w, $2 1080w""></amp-img>") ImgToAmpImg = ClsTempLoseStr Set regEx = Nothing End Function |
未经允许不得转载:Windy's Blog » asp 正则 img 转 amp-img