#! ruby -Ku require "kconv" def check(str) if /[\d,]+/ =~ str then print(Kconv.tosjis("○") + str + "\n") else print(Kconv.tosjis("×") + str + "\n") end end print(Kconv.tosjis("[\\d,]+ にマッチするかどうか\n\n")) check("1500") check("1,340") check("ab1") check("abc")