From: Martin DeMello Date: 2002-11-28T16:33:36+09:00 Subject: Re: simple regexp question Shannon Fang wrote: > Hi > > In ruby, I can use the following to match a regexp: > > if string=~/pattern/ then ... > > However, the following does not work, > > if string!~/pattern/ then... > > I'll have to write > > if !(string=~/pattern/) then... Since method names can include !, this gets read as if string! ~ /pattern/ and fails because there's no Object#string! Both the following work: if string !~ pattern if "hello world"!~ pattern martin