From: "Hanmac (Hans Mackowiak)" Date: 2013-09-18T23:46:54+09:00 Subject: [ruby-core:57263] [ruby-trunk - Feature #8921] Allow select, reject, etc to accept a regex Issue #8921 has been updated by Hanmac (Hans Mackowiak). 1) it can be done via class Regexp def to_proc proc {|o| self.match(o) } end end 2) but i think the method you are looking for is grep %w[foo bar baz].grep /^ba/ # => ["bar", "baz"] ---------------------------------------- Feature #8921: Allow select, reject, etc to accept a regex https://bugs.ruby-lang.org/issues/8921#change-41881 Author: kyledecot (Kyle Decot) Status: Open Priority: Normal Assignee: Category: Target version: It would be really handy if for instance `select` could accept a regex. For example ``` %w[foo bar baz].select /^ba/ # ["bar", "baz"] ``` I know that this is currently possible via the slightly longer syntax ``` %w[foo bar baz].select{|i| i[/^ba/] } # ["bar", "baz"] ``` -- http://bugs.ruby-lang.org/