* re.c (rb_reg_s_last_match): Update $~ to reference Regexp
documentation about "special global variables". [Bug #6723] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ea6da56a65
commit
a10f6137cc
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jul 25 06:49:12 2012 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
|
* 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@segment7.net>
|
Wed Jul 25 06:28:56 2012 Eric Hodel <drbrain@segment7.net>
|
||||||
|
|
||||||
* iseq.c: Added documentation. Patch by David Albert. [Bug #6785]
|
* iseq.c: Added documentation. Patch by David Albert. [Bug #6785]
|
||||||
|
16
re.c
16
re.c
@ -3437,14 +3437,16 @@ match_setter(VALUE val)
|
|||||||
* Regexp.last_match -> matchdata
|
* Regexp.last_match -> matchdata
|
||||||
* Regexp.last_match(n) -> str
|
* Regexp.last_match(n) -> str
|
||||||
*
|
*
|
||||||
* The first form returns the <code>MatchData</code> object generated by the
|
* The first form returns the MatchData object generated by the
|
||||||
* last successful pattern match. Equivalent to reading the global variable
|
* last successful pattern match. Equivalent to reading the special global
|
||||||
* <code>$~</code>. The second form returns the <i>n</i>th field in this
|
* variable <code>$~</code> (see Special global variables in Regexp for
|
||||||
* <code>MatchData</code> object.
|
* details).
|
||||||
* <em>n</em> can be a string or symbol to reference a named capture.
|
|
||||||
*
|
*
|
||||||
* Note that the <code>last_match</code> is local to the thread and method scope
|
* The second form returns the <i>n</i>th field in this MatchData object.
|
||||||
* of the method that did the pattern match.
|
* _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
|
* /c(.)t/ =~ 'cat' #=> 0
|
||||||
* Regexp.last_match #=> #<MatchData "cat" 1:"a">
|
* Regexp.last_match #=> #<MatchData "cat" 1:"a">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user