1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29:
Sub testingRegExp() Dim strBody As String Dim intFile As Integer intFile = FreeFile Open "C\strbody.txt" For Input As #intFile strBody = Input$(LOF(intFile), #intFile) ' LOF returns Length of File Close #intFile Dim RegX As Object, Mats As Object, Counter As Long Set RegX = CreateObject("VBScript.RegExp") With RegX .Global = True .MultiLine = True .IgnoreCase = True .Pattern = "TO BE DEFINED" Set Mats = .Execute(strBody) End With For Counter = 0 To Mats.Count - 1 Debug.Print Mats(Counter) Next Set Mats = Nothing Set RegX = Nothing End Sub