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.
すべての文字が数字 [0-9]+ であることを確認する reqex が必要です。私が試してみました:
'4th'=~/[\d]+/ '4th'=~/\d+/
しかし、機能していません。これを確認するにはどうすればよいですか?
どうも
最も簡単な方法は次のとおりです。
str !~ /\D/
"12345" =~ /\A\d+\Z/