#! ruby -Ku require "kconv" def check(str) print(Kconv.tosjis(str + " は /入門/ に")) reg = Regexp.compile("入門") if reg =~ str then print(Kconv.tosjis("マッチします\n")) else print(Kconv.tosjis("マッチしません\n")) end end check("Ruby入門") check("入門する") check("入社する")