简体   繁体   English

正则表达式查找日期时间中日期部分的字母数字匹配

[英]Regex to find alphanumeric match with day part of datetime

I have to match string like "DAY1","DAY2","DAY3"....."DAY31" with regex in vb.net. 我必须在vb.net "DAY1","DAY2","DAY3"....."DAY31"正则表达式匹配字符串"DAY1","DAY2","DAY3"....."DAY31" I tried something like this - ^?DAY(0[1-9]|[12][0-9]|3[01])$ but it did not work. 我尝试过类似的操作- ^?DAY(0[1-9]|[12][0-9]|3[01])$但没有用。 Please help. 请帮忙。

The pattern should have succesfull match if the source string is either DAY1 or DAY2 or DAY3 to DAY31 like so. 图案应当具有succesfull匹配如果源串或者是DAY1DAY2DAY3DAY31像这样。

尝试使用以下正则表达式(删除第一个数字前的?0 ):

^DAY([1-9]|[12][0-9]|3[01])$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM