On Jun 28, 4:00 pm, Philip Hallstrom <r... / philip.pjkh.com> wrote: > > How can I make a regular expression that will match everything, unless > > it contains a certain string then it will match nothing. > > > For instance, let's say it should not match "bar", then: > > > "foo" => "foo" > > "bar " => nil > > "foobar" => nil > > some_string !~ /bar/ > > -philip Yeah, that's the easy way, is it possible to do that with the regular expression alone and not use !~? The reason is because this is not exactly for Ruby and I don't have another option. Thanks