Hello I am currently working on a project to bring in Regular Expressions into Excel using the VBSCRIPT_RegExp_1. I am using the vba code below.
Function RegExGet(aString As String, myExpression As String) As Variant
Dim RegEx As New VBScript_RegExp_10.RegExp
Dim newArray() As String
RegEx.Pattern = myExpression
RegEx.IgnoreCase = True
RegEx.Global = True
Set Matches = RegEx.Execute(aString)
x = Matches.Count
ReDim newArray(x - 1) As String
cnt = 0
For Each Match In Matches
newArray(cnt) = Match.Value
cnt = cnt + 1
Next
RegExGet = newArray()
End Function
The problem with the code is that if returns multiple results, only the first will show up. It will create a 1 by 1 array where any other results besides the first is hidden. Wh
What I am hoping for is a modification so that the array that is produced, at whatever size it may be, concatenates all the results with a ";" between them. Ie "1; 2; 3;". Any tips on how JOIN or CONCATENATE may be used would be most welcome!
Thanks and have a nice day!