GetDate in a string in c#

Posted by Doncho on Stack Overflow See other posts from Stack Overflow or by Doncho
Published on 2010-03-08T10:01:43Z Indexed on 2010/03/08 10:06 UTC
Read the original article Hit count: 268

Filed under:
|
|

Hi,

I'm having some trouble using regular expression to get date in a string. Example :

 string text = "75000+ Sept.-Oct. 2004";
MatchCollection dates = Regex.Matches(text, @"[0-9]{5,}[+][\s](jan|feb|fev|mar|apr|avr|may|mai|jun|jui|jul|jui|aug|aoû|sept|oct|nov|dec)[\.][\-](jan|feb|fev|mar|apr|avr|may|mai|jun|jui|jul|jui|aug|aoû|sept|oct|nov|dec)[\.]\s[0-9]{4}", RegexOptions.IgnoreCase);

This code is matching with my current string but i would like to get in my matchcollection, "Sept 2004" and "Oct 2004" in order to parse it in 2 datetime.

If anyone have any idea, thanks a lot.

© Stack Overflow or respective owner

Related posts about datetime

Related posts about c#