Thursday, June 2, 2022

VBS - Extract JSON

 '******************************************

Function Extract(Data,Pattern)

   Dim oRE,oMatches,Match,Line

   set oRE = New RegExp

   oRE.IgnoreCase = True

   oRE.Global = True

   oRE.Pattern = Pattern

   set oMatches = oRE.Execute(Data)

   If not isEmpty(oMatches) then

       For Each Match in oMatches  

           Line = Line & Trim(Match.Value) & vbCrlf

       Next

       Extract = Line

   End if

End Function

'******************************************

No comments: