#! ruby -Ku require "kconv" def check(str) print(Kconv.tosjis(str + " は ^abc に")) if /^abc/ =~ str then print(Kconv.tosjis("マッチします\n")) else print(Kconv.tosjis("マッチしません\n")) end end check("abcdef") check("defabc") check("abc\ndef") check("def\nabc")