‘================================================== ‘函数名:GetArray ‘作 用:提取链接地址,以$Array$分隔 ‘参 数:ConStr ------提取地址的原字符 ‘参 数:StartStr ------开始字符串 ‘参 数:OverStr ------结束字符串 ‘参 数:IncluL ------是否包含StartStr ‘参 数:IncluR ------是否包含OverStr ‘================================================== Function GetArray(Byval ConStr,StartStr,OverStr,IncluL,IncluR) On Error Resume Next If ConStr="$False$" or ConStr="" Or IsNull(ConStr)=True or StartStr="" Or OverStr="" or IsNull(StartStr)=True Or IsNull(OverStr)=True Then GetArray="$False$" Exit Function End If Dim TempStr,TempStr2,objRegExp,Matches,Match,Templisturl TempStr="" Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "("&StartStr&").+?("&OverStr&")" Set Matches =objRegExp.Execute(ConStr) For Each Match in Matches if Templisturl =Match.Value then Else TempStr=TempStr & "$Array$" & Match.Value Templisturl=Match.Value end if Next Set Matches=nothing If TempStr="" Then GetArray="$False$" Exit Function End If TempStr=Right(TempStr,Len(TempStr)-7) If IncluL=False then objRegExp.Pattern =StartStr TempStr=objRegExp.Replace(TempStr,"") End if If IncluR=False then objRegExp.Pattern =OverStr TempStr=objRegExp.Replace(TempStr,"") End if Set objRegExp=nothing Set Matches=nothing TempStr=Replace(TempStr,"""","") TempStr=Replace(TempStr,"‘","") TempStr=Replace(TempStr," ","") ‘TempStr=Replace(TempStr,"(","") ‘TempStr=Replace(TempStr,")","") If TempStr="" then GetArray="$False$" Else GetArray=TempStr End if End Function
时间: 2024-10-10 17:39:04