diff options
author | zzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-06 19:38:18 +0000 |
---|---|---|
committer | zzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-10-06 19:38:18 +0000 |
commit | 1b5ce6132748f4766e167aebefd7028c0e93ea3c (patch) | |
tree | 5df36c06888cf4bbde3dd223d53ccbf8057a7cac /string.c | |
parent | 974e3c9c5d15af79a7992a55fb37b07ee0a7532f (diff) |
* 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
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 */ |