Public Function ExtractTMIData(ByVal strXX As String) As Ticket()
Dim reg As New regExp
' reg.Pattern = "Customer Information\s+Customer"
reg.Pattern = "Customer\n(.*)\nContact Telephone Number"
reg.Global = True
reg.IgnoreCase = True
Dim Matches As MatchCollection
Set Matches = reg.Execute(strXX)
End Function
Public Function ExtractTMIData(ByVal strXX As String) As Ticket()
Dim reg As New regExp
' reg.Pattern = "Customer Information\s+Customer"
reg.Pattern = "Customer\n\r(.*)\n\rContact Telephone Number"
reg.Global = True
reg.IgnoreCase = True
Dim Matches As MatchCollection
Set Matches = reg.Execute(strXX)
ExtractTMIData = Matches(0).SubMatches(0)
End Function
ExtractTMIData = Matches(0).SubMatches(0)
generated an error code. Dim myMatch As Match
Dim myMatches As MatchCollection
Dim myRegExp As RegExp
Set myRegExp = New RegExp
myRegExp.Pattern = "Customer\r?\n(.*)"
Set myMatches = myRegExp.Execute(SubjectString)
For Each myMatch In myMatches
'matched text: myMatch.Value
'match start: myMatch.FirstIndex
'match length: myMatch.Length
'backreference n text: myMatch.SubMatches(n-1)
Next
pls try EDITED
Open in new window
REgards