
for each v in coll_numbers("y = 9,8864x4 - 166,24x3 + 982,08x2 - 2331,1x + 3028,6 "):?v:next
9,8864
166,24
982,08
2331,1
3028,6
Option Explicit
Function coll_numbers(s As String) As Collection
Dim re As Object, match As Variant, mycoll As Collection
Set re = CreateObject("VBScript.RegExp")
re.pattern = "d+(?:,)d+"
re.IgnoreCase = True
re.Global = True
Set mycoll = New Collection
If re.Test(s) Then
For Each match In re.Execute(s)
mycoll.Add match
Next
Else
mycoll.Add s
End If
Set coll_numbers = mycoll
End Function |
re.pattern = "d+(?:,)d+|d+(?!x)d+" |
