String manipulation
Function FindDate(ByVal TextIn As String) As String
Static regex As Object, matches As Object
Dim x As Integer
Dim sRet As String
If regex Is Nothing Then
Set regex = CreateObject("vbscript.regexp")
regex.Pattern = "[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4}"
regex.Global = True
regex.ignorecase = True
End If
sRet = ""
Set matches = regex.Execute(TextIn)
If matches.Count 0 Then
For x = 0 To matches.Count - 1
sRet = sRet & IIf(sRet = "", "", ",") & matches(x).Value
Next x
End If
FindDate = sRet
End Function
--
Tim Williams
Palo Alto, CA
"Ray Batig" wrote in message
link.net...
Greetings,
I have tried to write code to do this simple string manipulation, however,
I
have not been successful. I guess I am just looking at it wrong.
An example string is Baby Blue 01/02/05 . 'Baby Blue' can be various words
and also there can be more. What I need to do is strip away the date
characters so I can change them. I can handle everything except stripping
away the existing date characters. How is this programmed?
Thanks in advance for your help!!
|