我想匹配通过正则表达式解析字符串。这是我到目前为止有:正则表达式困扰和正确解析字符串
private string result = @"Range:\s*(?<start>.+\S)\s*to\s*(?<end>.+\S)[\S\s]+For more information, click the link below";
和代码解析:
start = Convert.ToDateTime(matches.Groups["start"].Value)
end = Convert.ToDateTime(matches.Groups["end"].Value)
下面是一个例子字符串输入:
范围:2016年6月8日至2016年6月9日
欲了解更多信息,请点击下面的链接
的start
变量是如下预期:
2016年6月8日12:00:00 AM
的end
变量被格式化为DateTime
引发错误。当我输出end
正则表达式匹配的值,它出来是这样的:
2016年6月9日更多的Infor .....
什么我在我的正则表达式失踪?