From: Ralph Mason Date: 2002-03-26T07:06:13+09:00 Subject: RegExp to string I have been using a simple regexp match to find is a string contains another string. This has been working fine until the matched string contained a regexp character. I wonder if the code in string =~ should do a Regexp.escape if the incomming expression is a string? Example irb(main):039:0> x = "jane and tarzan" "jane and tarzan" irb(main):040:0> y = "tarzan" "tarzan" irb(main):041:0> z = "tarzan (" "tarzan (" irb(main):042:0> x=~y 9 irb(main):043:0> x=~z RegexpError: premature end of regular expression: /tarzan (/ from (irb):43:in `=~' from (irb):43 irb(main):044:0> Ralph