summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorsonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 23:38:17 +0000
committersonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-21 23:38:17 +0000
commit71b932d675b53cbad6048e2c44a86b39b4310ad3 (patch)
tree33c6c6a7c85c5a12b4c8df0bfab1d682e576a27e /doc
parentba9e870709d59cfea8c84bb2ef8f217bd3923e79 (diff)
* doc/regexp.rdoc: In regexp doc, two backslashes match one literally
In the "Metacharacters and Escapes" section of regexp.rdoc, it said that to match a backslash literally, it must be backslash-escaped, but the rendered HTML showed three backslashes (\\\). There should only be two backslashes (\\). patched by jlmuir (J. Lewis Muir) [fix GH-1677] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc')
-rw-r--r--doc/regexp.rdoc3
1 files changed, 2 insertions, 1 deletions
diff --git a/doc/regexp.rdoc b/doc/regexp.rdoc
index a6421a5e80..06c730058d 100644
--- a/doc/regexp.rdoc
+++ b/doc/regexp.rdoc
@@ -63,9 +63,10 @@ The following are <i>metacharacters</i> <tt>(</tt>, <tt>)</tt>,
<tt>[</tt>, <tt>]</tt>, <tt>{</tt>, <tt>}</tt>, <tt>.</tt>, <tt>?</tt>,
<tt>+</tt>, <tt>*</tt>. They have a specific meaning when appearing in a
pattern. To match them literally they must be backslash-escaped. To match
-a backslash literally backslash-escape that: <tt>\\\\\\</tt>.
+a backslash literally, backslash-escape it: <tt>\\\\</tt>.
/1 \+ 2 = 3\?/.match('Does 1 + 2 = 3?') #=> #<MatchData "1 + 2 = 3?">
+ /a\\\\b/.match('a\\\\b') #=> #<MatchData "a\\b">
Patterns behave like double-quoted strings so can contain the same
backslash escapes.