diff --git a/string.c b/string.c index aa26f35d60..154f8e98d9 100644 --- a/string.c +++ b/string.c @@ -11859,7 +11859,7 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc) * However, you may refer to some special match variables using these * combinations: * - * - \& corresponds to $&, + * - \& and \0 correspond to $&, * which contains the complete matched text. * - \' corresponds to $', * which contains string after match. @@ -11894,11 +11894,12 @@ rb_enc_interned_str_cstr(const char *ptr, rb_encoding *enc) * the replacing string is the value for that key: * * h = {'foo' => 'bar', 'baz' => 'bat'} - * 'food'.sub('oo', h) # => "fd" + * 'food'.sub('foo', h) # => "bard" + * + * Note that a symbol key does not match: + * * h = {foo: 'bar', baz: 'bat'} - * 'food'.sub('oo', h) # => "fd" - * h = {foo: :bar, baz: :bat} - * 'food'.sub('oo', h) # => "fd" + * 'food'.sub('foo', h) # => "d" * * Block *