|
发表于 2024-8-22 17:59
来自手机
|
显示全部楼层
weiyingde 发表于 2024-8-20 07:06
谢谢提醒和指教。
Sub zczxyc() '正则:?<=,?<!
Dim ws As Object, r$, s$, st$, pn$
Set ws = CreateObject("WScript.Shell")
st = "<span>阅读数量:345</span>" '字符串
pn = "(?<=<span>阅读数量:)\d+" '正则
s = "$ms=[System.Text.RegularExpressions.Regex]"
s = s & "::Matches('" & st & "','" & pn & "');"
s = s & "for($i=0;$i -lt $ms.Count;$i++)"
s = s & "{$t=$ms[$i];$p=$t.Groups[0].Value;$p}"
'或"PowerShell -Command " '以下执行返回值
r = ws.exec("PowerShell " & s).stdout.readall
End Sub |
|