From: Iain 'Spoon' Truskett Date: 2002-12-06T11:04:59+09:00 Subject: Re: Regexp imxo - does 'x' work? * Ted (ted@datacomm.com) [06 Dec 2002 13:02]: > * Iain wrote: > > > perl -e 'print "foobar" =~ /foo bar/x' >> 1 > > > ruby -e 'print "foobar" =~ /foo bar/x' >> 0 > > > > Perl is returning whether there was a match (undef if no match). > > Ruby is returning the offset of the match (strings start at 0). > .. and it returns 'nil' for no match? Correct. The ruby equivalent of undef =) ruby -e 'print "foobar" =~ /fred/' perl -e 'print "foobar" =~ /fred/' cheers, -- Iain.