From: Dipesh Batheja Date: 2008-04-15T22:17:51+09:00 Subject: Re: Reg Exp Problem is i have function, which takes a regex as the parameter. I want to pass this regex in such a way that the function returns false if the string is matched and true if it isn't. I want the regex itself specify that if it matches the given string then it is false otherwise true. Jes炭s Gabriel y Gal叩n wrote: > On Tue, Apr 15, 2008 at 2:59 PM, 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? > > Simple approach: > > irb(main):007:0> a = "hello world" > => "hello world" > irb(main):008:0> !(a =~ /hello/) > => false > irb(main):009:0> !(a =~ /asdfsdf/) > => true > > Jesus. -- Posted via http://www.ruby-forum.com/.