1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_str_match):

Clarify behavior for captured strings and local variable assignment
  Patch by Marcus Stollsteimer [ruby-dev:47668] [Bug #7062]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
zzak 2012-10-06 19:38:18 +00:00
parent 974e3c9c5d
commit 1b5ce61327

View file

@ -2699,6 +2699,10 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
* <i>obj.=~</i>, passing <i>str</i> as an argument. The default
* <code>=~</code> in <code>Object</code> returns <code>nil</code>.
*
* Note: <code>str =~ regexp</code> is not the same as
* <code>regexp =~ str</code>. Strings captured from named capture groups
* are assigned to local variables only in the second case.
*
* "cat o' 9 tails" =~ /\d/ #=> 7
* "cat o' 9 tails" =~ 9 #=> nil
*/