ruby-changes:24475
From: drbrain <ko1@a...>
Date: Wed, 25 Jul 2012 06:55:28 +0900 (JST)
Subject: [ruby-changes:24475] drbrain:r36526 (trunk): * re.c (rb_reg_s_last_match): Update $~ to reference Regexp
drbrain 2012-07-25 06:49:31 +0900 (Wed, 25 Jul 2012) New Revision: 36526 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36526 Log: * re.c (rb_reg_s_last_match): Update $~ to reference Regexp documentation about "special global variables". [Bug #6723] Modified files: trunk/ChangeLog trunk/re.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36525) +++ ChangeLog (revision 36526) @@ -1,3 +1,8 @@ +Wed Jul 25 06:49:12 2012 Eric Hodel <drbrain@s...> + + * re.c (rb_reg_s_last_match): Update $~ to reference Regexp + documentation about "special global variables". [Bug #6723] + Wed Jul 25 06:28:56 2012 Eric Hodel <drbrain@s...> * iseq.c: Added documentation. Patch by David Albert. [Bug #6785] Index: re.c =================================================================== --- re.c (revision 36525) +++ re.c (revision 36526) @@ -3437,15 +3437,17 @@ * Regexp.last_match -> matchdata * Regexp.last_match(n) -> str * - * The first form returns the <code>MatchData</code> object generated by the - * last successful pattern match. Equivalent to reading the global variable - * <code>$~</code>. The second form returns the <i>n</i>th field in this - * <code>MatchData</code> object. - * <em>n</em> can be a string or symbol to reference a named capture. + * The first form returns the MatchData object generated by the + * last successful pattern match. Equivalent to reading the special global + * variable <code>$~</code> (see Special global variables in Regexp for + * details). * - * Note that the <code>last_match</code> is local to the thread and method scope - * of the method that did the pattern match. + * The second form returns the <i>n</i>th field in this MatchData object. + * _n_ can be a string or symbol to reference a named capture. * + * Note that the last_match is local to the thread and method scope of the + * method that did the pattern match. + * * /c(.)t/ =~ 'cat' #=> 0 * Regexp.last_match #=> #<MatchData "cat" 1:"a"> * Regexp.last_match(0) #=> "cat" -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/