From mboxrd@z Thu Jan 1 00:00:00 1970 From: wmorgan-sup@masanjin.net (William Morgan) Date: Mon, 27 Jul 2009 09:53:58 -0700 Subject: [sup-talk] Choose "From:" address based on message content? In-Reply-To: <1248317360-sup-4094@sgoldmanlinux.tower-research.com> References: <1248311332-sup-1053@sgoldmanlinux.tower-research.com> <1248317360-sup-4094@sgoldmanlinux.tower-research.com> Message-ID: <1248713574-sup-6167@entry> Reformatted excerpts from Steve Goldman's message of 2009-07-22: > require 'eregex' > > r = Regexp.new('word', Regexp::IGNORECASE); > if header.to_s.grep(r).size > 0 or body.to_s.grep(r).size > 0 You can just use body.to_s =~ /word/i || header.join =~ /i/. No need for all the fancy libraries and method calls. -- William