[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. Option Explicit
  2. Test
  3. '************************************************************************
  4. Sub Test()
  5. '************************************************************************
  6.     Dim str, strPattern
  7.     str = "https://agc.qq.com/show/chan"
  8.     strPattern = "http[s]{0,1}:\/\/[0-9A-z\.]+?\/([^\/]+)?[\/]{0,1}?.*"
  9.     MsgBox GetRE_SM0(str, strPattern)
  10. End Sub
  11. '************************************************************************
  12. '正則表達式:取得字符串的第一個子匹配項目
  13. '************************************************************************
  14. Function GetRE_SM0(ByVal str, ByVal strPattern)
  15.     Dim oRE
  16.     Set oRE = CreateObject("vbScript.regExp")
  17.     oRE.Pattern = strPattern
  18.     If oRE.Test(str) Then
  19.         If oRE.Execute(str)(0).SubMatches.Count >= 1 Then
  20.             GetRE_SM0 = oRE.Execute(str)(0).SubMatches(0)
  21.         End If
  22.     End If
  23.     Set oRE = Nothing
  24. End Function
复制代码
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

返回列表