diff --git a/ChangeLog b/ChangeLog index cf145f1ae5..c3aa36ccdc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jun 9 08:16:47 2012 Eric Hodel + + * doc/re.rdoc: Completed wording in the description of the =~ operator. + [ruby-trunk - Bug #6529] + Sat Jun 9 08:09:38 2012 Eric Hodel * string.c (rb_str_start_with): Removed "p" from start_with? examples 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. === =~ operator =~ 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 =~.) 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