From: Robert Dober Date: 2008-08-23T18:06:10+09:00 Subject: Re: REGULAR EXPRESSION On Sat, Aug 23, 2008 at 9:06 AM, Newb Newb wrote: > Newb Newb wrote: >> Hi all >> I am not Expert at Rails or Ruby >> I have a string ..it contains text and images also.. >> from that string i want to replace the All The Images Into >> Empty>space..that is images Has to Be Removed. >> >> I tried like below >> >> item.description = item.description.gsub(/\<*img.*src=".*".*?\/\>/,' ') The . stays for any character, as such your regular expression seems to be way too greedy. This however should not harm too much if there is only one img tag in one line, although backtracking might be a performance issue. I do however fail to understand the behavior you described. Anyway, I believe the following regex should do fine: item.description.gsub! //, "" HTH Robert -- http://ruby-smalltalk.blogspot.com/ There's no one thing that's true. It's all true. -- Ernest Hemingway