Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一个 reqex 来检查每个字符是否为数字 [0-9]+。我试过了:
'4th'=~/[\d]+/ '4th'=~/\d+/
但不工作。我将如何检查这个?
谢谢
最简单的方法是:
str !~ /\D/
"12345" =~ /\A\d+\Z/