#! ruby -Ku require "kconv" def check(str) if /200[345678]/ =~ str then print(Kconv.tosjis("○") + str + "\n") else print(Kconv.tosjis("×") + str + "\n") end end print(Kconv.tosjis("200[345678] にマッチするかどうか\n\n")) check("2007") check("2008year") check("2002") check("2009") check("2006.10.4")