#! ruby -Ku require "kconv" def check(str) if /No(0|1|2|3|4|5|6|7|8|9)+ is/ =~ str then print(Kconv.tosjis("○") + str + "\n") else print(Kconv.tosjis("×") + str + "\n") end end print(Kconv.tosjis("No(0|1|2|3|4|5|6|7|8|9)+ is にマッチするかどうか\n\n")) check("No01 is Yamada") check("No12506 is Honda") check("No.01 is Kuroda") check("No12.5 is Endou")