From: wx Date: 2007-12-09T01:25:00+09:00 Subject: Regexp: str1-anything but str2-str2 => str1-str2 A simple question about whether this can be done with regular expressions in Ruby: str = < function test(a) { return a < 5; } between1 between2 between3 between4 end EOS re = /what here?!/ puts str.gsub(re, '----------------- zapped -------------------') Can re be written so the output is similar to: start between1 between2 between3 between4 end I tried the following, but no luck: re = / and replace anything in between, but regexps are just sweet, so I was still trying with them.