From: Chris Date: 2002-04-11T11:55:10+09:00 Subject: Re: RegExp for "AND" search pattern... In article <3b3ad3b4.0204101533.638f26d6@posting.google.com>, patrick-may@monmouth.com (Patrick May) wrote: > How could a regexp be constructed for an "AND" search pattern? How about... class String def re_and_search ( *patterns ) patterns.flatten! patterns.collect! do |x| x.type == "Regexp" ? x : Regexp.new(Regexp.escape(x.to_s)) end all_match = true for x in patterns unless self =~ x all_match = false break end end all_match end end