开发者

Match 0 to 60 in regular expression

开发者 https://www.devze.com 2023-02-02 16:16 出处:网络
What is the regular expression to match the numbers 0 through 60?No negat开发者_如何学Pythonive numbers allowed and no decimals.Like this:^([0-5]?[0-9]|60)$

What is the regular expression to match the numbers 0 through 60? No negat开发者_如何学Pythonive 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)


Assuming Perl compatible regular expressions, and no leading zeroes

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

精彩评论

暂无评论...
验证码 换一张
取 消