I’m writing a little application that will open my status reports that are in Word doc format. The document has several dates but the ones I want to find and change are like this:
Start Date: 05/14/2012End Date: 05/18/2012
I’m writing this in VB.NET I can use the String.IndexOf("Start Date: ") method and it finds the word, but I was hoping to get the index position, then using String.Length, get the date field to modify it for each of the start and end date dates.
If (result.IndexOf("Start Date:") <> -1) Then
Console.WriteLine("Start Date Found!")
End If
I thought about using RegEx but I don’t think I’m that clever.
This is a regex that will extract the dates for you:
/(?:Start|End) Date: (\d{2}\/\d{2}\/\d{4})/Each date will be in its own captured group once you run this regex on your string.
An example in VB: