From: Brian Candler Date: 2010-06-16T05:29:53+09:00 Subject: Re: split doesn't work Firstly, I suggest you write this as a standalone ruby program without erb, so it's easy to debug. Secondly, add debugging print statements to show what the variables are doing at each stage. Your code uses both @def and @def_str, so I'm having to guess what you're trying to do, but I imagine something like this: @terms = %w(cuddly soft cute) @def_str = "teddy bears are cuddly stuffed animals which are generally soft and given to cute children" @def = @def_str @terms.each do |term| regex = Regexp.new(/#{term}/) matchdata = regex.match(@def_str) if matchdata puts "Match!" puts "Before: @def = #{@def.inspect}" -- Posted via http://www.ruby-forum.com/.