#! ruby -Ku require "kconv" def check1(str) if / .+ / =~ str then print(Kconv.tosjis("○") + str + "\n") print(Kconv.tosjis("[" + $& + "]") + "\n") else print(Kconv.tosjis("×") + str + "\n") end end def check2(str) if / .+ /m =~ str then print(Kconv.tosjis("○") + str + "\n") print(Kconv.tosjis("[" + $& + "]") + "\n") else print(Kconv.tosjis("×") + str + "\n") end end print(Kconv.tosjis("/ .+ / にマッチするかどうか\n\n")) check1("One Hamburger\nand a Coffee please") print("\n") print(Kconv.tosjis("/ .+ /m にマッチするかどうか\n\n")) check2("One Hamburger\nand a Coffee please")