summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-21 05:08:28 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-21 05:08:28 +0000
commita2126a678c1b2b3f972872778f267c9461ffc771 (patch)
tree2f508afa8b6cda542fd4c0beac1ed57fbf5eeead /string.c
parent7a03d4637cefadadad31fff5bdd6c20a8e5a00bd (diff)
merge revision(s) 50509: [Backport #11132]
* string.c: added documentation for character sequence \' with String#sub [Bug #11132][ruby-core:69121][fix GH-900][ci skip] Patch by @shishir127 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@50582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string.c b/string.c
index a9b0b8bcc0..ef4e8b0328 100644
--- a/string.c
+++ b/string.c
@@ -4088,6 +4088,9 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
* double-quoted string, both back-references must be preceded by an
* additional backslash. However, within +replacement+ the special match
* variables, such as <code>&$</code>, will not refer to the current match.
+ * If +replacement+ is a String that looks like a pattern's capture group but
+ * is actaully not a pattern capture group e.g. <code>"\\'"</code>, then it
+ * will have to be preceded by two backslashes like so <code>"\\\\'"</code>.
*
* If the second argument is a Hash, and the matched text is one of its keys,
* the corresponding value is the replacement string.