The following code is what ive come up with so far. I have also set the reference for regular expression 5.5.
However the match value does not show at all, am I missing something here??
Public Sub check()
Dim wb As Workbook
Set wb = ThisWorkbook
'Prepare a regular expression object
Dim myRegExp As New VBScript_RegExp_55.RegExp
Dim myMatches As MatchCollection
Dim myMatch As match
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "^\d{6,8}-[SFTG]\d{7}[A-Z]-([^-]+)$"
Set myRegExp = CreateObject("vbscript.regexp")
cellValue = CStr(wb.Worksheets(1).Cells(2, 4).Value)
'123456-S1234567F-Scholarship Form
If myRegExp.Test(cellValue) Then
Set myMatches = myRegExp.Execute(cellValue)
For Each myMatch In myMatches
MsgBox (myMatch.Value)
Next
Else
End If
End Sub
wb.Worksheets(1).Cells(2, 4).Valuewhich you want to parse.123456-S1234567F-Scholarship Formstring ?