On Fri, Nov 18, 2016 at 1:20 PM, Die Optimisten
<inform / die-optimisten.net> wrote:
> On 2016-11-17 10:39, timlen tse wrote:
>>
>> I think you want `String#[] `  for example:
>>  "sample"[/\d+/]
>>  # => nil
>
> Thank you!

This will not return the whole string though unless the regex matches
the whole string.

Can you be more specific about your intended use case?

Kind regards

robert

-- 
[guy, jim, charlie].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/

Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>