赞
踩
am/pm是可选的
const std::string dateAndTimeRegex =
"^\\s*" // ignore whitespace
"(" // start of date
"201[0-9]" // year: 2010, 2011, ..., through 2019
"\\W" // delimiter between year and month; typically will be "-"
"([0]?[0-9]|1[012])" // month: 0 through 9, or 00 through 09, or 10 through 12
"\\W" // delimiter between month and day; typically will be "-"
"([012]?[0-9]|3[01])" // day: 0 through 9, or 00 through 29, or 30, or 31
")?" // end of optional date
"\\s?" // optional whitespace
"(" // start of time
"([01]?[0-9]|2[0-3])" // hour: 0 through 9, or 00 through 19, or 20 through 23
"\\W" // delimiter between hours and minutes; typically will be ":"
"([0-5][0-9])" // minute: 00 through 59
"(" // start of seconds (optional)
"\\W" // delimiter between minutes and seconds; typically will be ":"
"([0-5][0-9])" // seconds: 00 through 59
")?" // end of optional seconds
"(\\s*[AaPp][Mm])?" // optional AM, am, PM, pm
")?" // end of optional time
"\\s*$"; // trailing whitespace LI>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。