yermej wrote: >> Raul >> -- >> Posted viahttp://www.ruby-forum.com/. > > Thanks, Raul, for the clarification on that. > > To the original poster, I apologize for the misinformation. > In the future, I may just keep quiet until I'm either sure I have > the correct answer or at least > don't understand why my answer isn't correct. yermej, I often follow your postings, that I find very interesting. But do not take hard this; no one can be perfect all of the time. In this case, it is very easy to fall in the alluring trap of the negative lookahead with '.*' (see how many people keep posting a variant of that solution.. ?!). However, I totally share one's feeling of dismay when we give an advice that turns out not to be right (or just not completely right); we just have to accept that we are fallible. In this case hats off to Daniel Sheppard, who showed us how to do it (I rewrite it to reinstate it, after all the emails that followed): x = 'cat sheep horse cat tac dog cat cat sheep dog cat' x.scan(/cat.*?dog/).map {|x| x.sub(/.*cat/,'cat')} => ["cat tac dog", "cat sheep dog"] Absolutely brilliant Raul -- Posted via http://www.ruby-forum.com/.