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:
parent
974e3c9c5d
commit
1b5ce61327
1 changed files with 4 additions and 0 deletions
4
string.c
4
string.c
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue