Try this. The problem is that the pattern does not actually require a comma to be present. It is using one pattern twice, to look on each side of a comma, but it never checks for the comma.
This version uses a single pattern to match the entire string. It produces a single match, and has four submatches, so it loops four times to capture each submatch. I tested this on your data. I also changed it so that it always returns an array of four strings, which makes it much easier to test.
Function TeamScore(ByVal txt As String)
Dim a As Variant, i As Long, n As Long
With CreateObject("VBScript.RegExp")
.Global = True
.Pattern = "^(.+) (\d+),(.+) (\d+)$"
a = Array("", "", "", "")
If .test(txt) Then
For i = 0 To 3
a(i) = Trim$(.Execute(txt)(0).submatches(i))
Next i
End If
TeamScore = a
End With
End Function
Bookmarks