我有一个Ruby正则表达式问题.
if string == /(^\d{1,3})/ # this matches both "24" and "24 gravida ut aliquam" # code... end
我希望正则表达式只匹配"24". 我该怎么做只允许数字?
ruby regex
regex ×1
ruby ×1