VBA Code(假設在 Excel 的活動工作表的 A1 單元格中存儲著上述 Json 字符串):
Option?ExplicitSub?ExtractJsonData()
Dim?objRegExp?As?Object
Dim?objMatch?As?Object
Dim?objMatches?As?Object
Set?objRegExp?=?CreateObject("VBScript.RegExp")
With?objRegExp
.IgnoreCase?=?True
.Global?=?True
.Pattern?=?"""issue"":""(\d+?)"",""opennum"":""(.*?)"""
If?.Test([A1])?Then
Set?objMatches?=?.Execute([A1])
For?Each?objMatch?In?objMatches
Debug.Print?objMatch.SubMatches(0);?objMatch.SubMatches(1)
Next
End?If
End?With
End?Sub
運行結果:
表達式就是代碼中的 Pattern 屬性值