简单实例:
string s = "2005-2-21";
regex reg = new regex(@"(?<y>/d{4})-(?<m>/d{1,2})-(?<d>/d{1,2})",regexoptions.compiled);
match match = reg.match(s);
int year = int.parse(match.groups["y"].value);
int month = int.parse(match.groups["m"].value);
int day = int .parse(match.groups["d"].value);
datetime time = new datetime(year,month,day);
新闻热点
疑难解答