From: mail@... Date: 2016-11-04T11:20:06+00:00 Subject: [ruby-core:77914] [Ruby trunk Feature#12898] String#match? method in addition to Regexp#match? Issue #12898 has been updated by Stefan Sch����ler. Shyouhei Urabe wrote: > You mean a String instance method named "match?" that takes a Regexp instance? Yes, exactly. The methods to match a string with a regexp (or vice versa) are present in both classes: `Regexp#=~` and `String#=~` `Regexp#match` and `String#match` With Ruby 2.4 there's `Regexp#match?` and it would only be consistent to implement `String#match?` as well. I would expect `String#match?` to work equivalent to `String#=~` and `String#match`, i.e. > **str.match?(pattern) -> true or false** > **str.match?(pattern,pos) -> true or false** > Converts _pattern_ to a `Regexp` (if it isn���t already one), then invokes its `match?` method on _str_. > Returns a (...) ---------------------------------------- Feature #12898: String#match? method in addition to Regexp#match? https://bugs.ruby-lang.org/issues/12898#change-61228 * Author: Stefan Sch����ler * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Ruby 2.4 introduces [`Regexp#match?`](https://bugs.ruby-lang.org/issues/8110). There should be an accompanying `String#match?` method. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>