Ruby 2.4 introduces Regexp#match?. There should be an accompanying String#match? method.
Can you be a bit more verbose here? You mean a String instance method named "match?" that takes a Regexp instance? Please show us in detail why you need that.
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 (...)