From: Marcelo Date: 2010-04-20T23:10:32+09:00 Subject: Re: Regexp: exclude a word or a phrase On Tue, Apr 20, 2010 at 07:29, Shuaib Zahda wrote: > i tried to use /[^=]+/ and it does  not work because it will > exclude statements with equal signs as well which is not my aim I don't think I understand your intent, but in order to match lines other than ones composed solely of =, try /^[^=]+$/ To match a location that does not contain a specific string, you can try: /(?!foo)/ this regular expression will match a location that does not contain the sequence "foo". Beware! Note that I'm writing "location", not "string". This matches: "foo" =~ /(?!foo)/ )/ # anything not followed by foo, match This also matches: "foobar" =~ /(?!bar)/ # anything not followed by bar, match You have to anchor it somehow: "foobar" =~ /foo(?!bar)/ # "foo" not followed by "bar", no match Marcelo