簡體   English   中英

在正則表達式中匹配0到60

[英]Match 0 to 60 in regular expression

匹配數字0到60的正則表達式是什么? 不允許使用負數,也不能使用小數。

像這樣: ^([0-5]?[0-9]|60)$

在C#中:

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

假設Perl兼容正則表達式,並且沒有前導零

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM