From: Jeff Schoolcraft Date: 2008-04-15T22:21:30+09:00 Subject: Re: Reg Exp ------=_Part_1270_27312957.1208265674742 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I'm not sure what you're going to gain from a regex if it's a specific string and not a pattern. irb(main):001:0> a = "Hello World" => "Hello World" irb(main):002:0> !(a.include? 'Hello') => false irb(main):003:0> It seems you'd want to wrap that into a method to make the intent a little more obvious irb(main):011:0> def should_filter?(source, word) irb(main):012:1> source.include? word irb(main):013:1> end => nil irb(main):014:0> should_filter?(a, 'Hello') Just a thought. to make the regex work as in your example though, you'd do this: irb(main):021:0> !(a =~ /hello/i) => false (case insensitive matching) On Tue, Apr 15, 2008 at 8:59 AM, Dipesh Batheja wrote: > Can somebody hep me with a very simple regular expression. I want to > write an regex which if matches a specific string should return false. > for example: > if i have string "Hello world", and i want to say, if you find "hello" > in this string then return false. Can someone explain how to write this? > -- > Posted via http://www.ruby-forum.com/. > > -- Jeff Schoolcraft http://thequeue.net/blog/ Microsoft MVP ------=_Part_1270_27312957.1208265674742--