summaryrefslogtreecommitdiff
path: root/doc/re.rdoc
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-08 23:17:00 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-08 23:17:00 +0000
commita60a58b183cfef7fc53ef7e1d3b7c661bd97d3cf (patch)
tree1dfe885ebf2568fda9832bd4d86a6cee85a47cf8 /doc/re.rdoc
parent9fa6147b9cef00aa1fad47372aad6c8b237ad21f (diff)
* doc/re.rdoc: Completed wording in the description of the =~ operator.
[ruby-trunk - Bug #6529] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc/re.rdoc')
-rw-r--r--doc/re.rdoc10
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/re.rdoc b/doc/re.rdoc
index 5f49ae228d..b912ca1d32 100644
--- a/doc/re.rdoc
+++ b/doc/re.rdoc
@@ -32,11 +32,15 @@ method.
=== <tt>=~</tt> operator
<tt>=~</tt> is Ruby's basic pattern-matching operator. When one operand is a
-regular expression and is a string (this operator is equivalently defined by
-Regexp and String). If a match is found, the operator returns index of first
-match in string, otherwise it returns +nil+.
+regular expression and the other is a string then the regular expression is
+used as a pattern to match against the string. (This operator is equivalently
+defined by Regexp and String so the order of String and Regexp do not matter.
+Other classes may have different implementations of <tt>=~</tt>.) If a match
+is found, the operator returns index of first match in string, otherwise it
+returns +nil+.
/hay/ =~ 'haystack' #=> 0
+ 'haystack' =~ /hay/ #=> 0
/a/ =~ 'haystack' #=> 1
/u/ =~ 'haystack' #=> nil