当前位置:   article > 正文

java正则表达式截取时间戳_正则表达式来验证时间戳

正则表达式截取时间戳

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>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/119330?site
推荐阅读
相关标签
  

闽ICP备14008679号