Question Get all dates from a string/piece of text

AzzKickah

Member
Joined
Mar 19, 2009
Messages
14
Programming Experience
Beginner
I'm stuck on an issue I think is actually pretty simple but I just can't get it sorted.

I have a string containing (a lot of) text, and in that text there are dates. Like 2/28/2010 or 11/12/2007 or whatever.
There are multiple dates in that text.

How do I get the dates from that piece of text into another string so I can put the dates into textboxes?

I'm using VB.NET in Visual Studio 2010 RC, in case that is of any use for you guys.
 
Last edited:
I have found the solution thanks to some guy on another forum, he pointed me to Regex and I have figured out the rest for myself:

VB.NET:
Imports System.Text.RegularExpressions

Public Class Form1

      Private Sub
            Dim GevondenDatums As MatchCollection = Regex.Matches("String to search dates in", "[0-9]*/[0-9]*/[0-9]{4}")
      End Sub

End Class
 
Back
Top