62,025
社区成员
发帖
与我相关
我的任务
分享
<%
regex.Pattern = "(?<=\[time_freeday\](\D*\d{4}-\d{2}-\d{2})*\D*)(?<from>\d{4}-\d{2}-\d{2})~(?<to>\d{4}-\d{2}-\d{2})"
regex.IgnoreCase = True
regex.Global = True
Set matches = regex.Execute(strVocation)
For Each match in matches
found = match.Value
response.Write(found&"</BR>")
Next
%>asp代码就这样了
Match m = Regex.Match(test, @"\[time_freeday\](\s*(?<reson>\w+)=(?<from>[\d-]+)~(?<to>[\d-]+))+");
int sum = 0;
for (int i = 0; i < m.Groups[1].Captures.Count; i++)
{
DateTime d1 = Convert.ToDateTime(m.Groups["from"].Captures[i].Value);
DateTime d2 = Convert.ToDateTime(m.Groups["to"].Captures[i].Value);
sum += (d2 - d1).Days + 1;
}
sum就是天数,不知道asp支不支持捕获?