Код |
---|
Function GetSum(s, p) Dim f(1 To 1, 1 To 2), m, re Set re = CreateObject("VBScript.RegExp"): re.Pattern = p f(1, 2) = "": GetSum = f If Not re.test(s) Then Exit Function re.Pattern = p & " \(([0-9 ]+)\) ([A-Z]+)" If Not re.test(s) Then Exit Function Set m = re.Execute(s)(0) f(1, 1) = Replace(m.submatches(0), " ", ""): f(1, 2) = m.submatches(1): GetSum = f End Function |
Программисты - это люди, решающие проблемы, о существовании которых Вы не подозревали, методами, которых Вы не понимаете!