当前位置:首页 > 通信资讯 > 正文
  1. FunctionAutoLinkURLs(strString)
  2. Dimmatch,matches,offset,url,email,link,relnkAutoLinkURL
  3. relnkAutoLinkURL="<ahref=""[[%URL%]]"">[[%URLText%]]</a>"
  4. IfNotIsObject(regExp)ThenSetregExp=NewRegExp
  5. regExp.Global=True
  6. regExp.IgnoreCase=True
  7. 'LookforURLs
  8. regExp.Pattern="(((ht|f)tps?://)|(www\.))([\w-]+\.)+[\w-:]+(/[\w-./?%#;&=]*)?"
  9. Setmatches=regExp.Execute(strString)
  10. offset=0
  11. ForEachmatchinmatches
  12. url=match
  13. IfLeft(url,4)="www."Thenurl="http://"&url
  14. link=Replace(Replace(relnkAutoLinkURL,"[[%URLText%]]",match),"[[%URL%]]",url)
  15. strString=Mid(strString,1,match.FirstIndex+offset)&link&Mid(strString,match.FirstIndex+1+match.Length+offset,Len(strString))
  16. offset=offset+Len(link)-Len(match)
  17. Next
  18. 'Lookforemails
  19. regExp.Pattern="[A-Za-z0-9_+-.']+@\w+([-.]\w+)*\.\w+([-.]\w+)*"
  20. Setmatches=regExp.Execute(strString)
  21. offset=0
  22. ForEachmatchinmatches
  23. email=match
  24. link=Replace(Replace(relnkAutoLinkURL,"[[%URLText%]]",match),"[[%URL%]]","mailto:"&email)
  25. strString=Mid(strString,1,match.FirstIndex+offset)&link&Mid(strString,match.FirstIndex+1+match.Length+offset,Len(strString))
  26. offset=offset+Len(link)-Len(match)
  27. Next
  28. AutoLinkURLs=strString
  29. EndFunction
如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。