--- !ruby/object:RDoc::RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: Converts <em>pattern</em> to a <tt>Regexp</tt> (if it isn't already one), then invokes its <tt>match</tt> method on <em>str</em>. If the second parameter is present, it specifies the position in the string to begin the search.
- !ruby/struct:RDoc::Markup::Flow::VERB 
  :body: "   'hello'.match('(.)\\1')      #=&gt; #&lt;MatchData &quot;ll&quot; 1:&quot;l&quot;&gt;\n   'hello'.match('(.)\\1')[0]   #=&gt; &quot;ll&quot;\n   'hello'.match(/(.)\\1/)[0]   #=&gt; &quot;ll&quot;\n   'hello'.match('xx')         #=&gt; nil\n"
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: If a block is given, invoke the block with MatchData if match succeed, so that you can write
- !ruby/struct:RDoc::Markup::Flow::VERB 
  :body: "   str.match(pat) {|m| ...}\n"
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: instead of
- !ruby/struct:RDoc::Markup::Flow::VERB 
  :body: "   if m = str.match(pat)\n     ...\n   end\n"
- !ruby/struct:RDoc::Markup::Flow::P 
  :body: The return value is a value from block execution in this case.
full_name: String#match
is_singleton: false
name: match
params: |
  str.match(pattern)   => matchdata or nil

visibility: public
