Project

General

Profile

Actions

Feature #8921

open

Allow select, reject, etc to accept a regex

Added by kyledecot (Kyle Decot) over 10 years ago. Updated about 4 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:57262]

Description

It would be handy if select could accept a regex. For example

%w[foo bar baz].select(/^ba/) # => ["bar", "baz"] 

This is currently possible via the slightly longer syntax

%w[foo bar baz].select{|i| i[/^ba/]} # => ["bar", "baz"] 

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #11049: Enumerable#grep_v (inversed grep)Closedmatz (Yukihiro Matsumoto)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0