From: Niklas Frykholm Date: 2002-02-18T17:27:02+09:00 Subject: Re: x =~ /pat/, "return type?" [David Alan Black]: > It actually returns the position in the string where the match > starts, or nil if there's no match. If you wanted it to return > true or false (but not nil), I guess you could do: > > (x =~ /pat/) && true || false > > Or could you get your class to recognize more general true/false > equivalences? Or is there some nicer/shorter way to do it > I'm not thinking of? :-) A standard trick for converting to boolean is: !!(x =~ /pat/) // Niklas