简体   繁体   中英

Match 0 to 60 in regular expression

What is the regular expression to match the numbers 0 through 60? No negative numbers allowed and no decimals.

Like this: ^([0-5]?[0-9]|60)$

In C#:

int temp;
if (int.TryParse(str, out temp) && temp >= 0 && temp <= 60)

假设Perl兼容正则表达式,并且没有前导零

/([1-5]?[0-9]|60)/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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