From: "Mauricio Fernández" Date: 2002-11-29T02:28:40+09:00 Subject: Re: simple regexp question On Thu, Nov 28, 2002 at 04:09:21PM +0900, 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... This is read as 'string! ~/pattern/', so ruby tries to call method '!' on object string, taking the argument '~ /pattern/' (~ == bitwise negation). > I'll have to write > > if !(string=~/pattern/) then... > > Any suggestion? Use spaces around operators :) -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Oh, I've seen copies [of Linux Journal] around the terminal room at The Labs. -- Dennis Ritchie