D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Regexp
/
Filename :
last_match-c.ri
back
Copy
U:RDoc::AnyMethod[iI"last_match:ETI"Regexp::last_match;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"9With no argument, returns the value of <tt>$~</tt>, ;TI":which is the result of the most recent pattern match ;TI"G(see {Regexp global variables}[rdoc-ref:Regexp@Global+Variables]):;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"/c(.)t/ =~ 'cat' # => 0 ;TI"5Regexp.last_match # => #<MatchData "cat" 1:"a"> ;TI" /a/ =~ 'foo' # => nil ;TI" Regexp.last_match # => nil ;T:@format0o; ; [I"LWith non-negative integer argument +n+, returns the _n_th field in the ;TI"'matchdata, if any, or nil if none:;T@o;; [ I"!/c(.)t/ =~ 'cat' # => 0 ;TI"%Regexp.last_match(0) # => "cat" ;TI"#Regexp.last_match(1) # => "a" ;TI"#Regexp.last_match(2) # => nil ;T; 0o; ; [I"NWith negative integer argument +n+, counts backwards from the last field:;T@o;; [I"*Regexp.last_match(-1) # => "a" ;T; 0o; ; [I",With string or symbol argument +name+, ;TI"<returns the string value for the named capture, if any:;T@o;; [ I"4/(?<lhs>\w+)\s*=\s*(?<rhs>\w+)/ =~ 'var = val' ;TI"ORegexp.last_match # => #<MatchData "var = val" lhs:"var"rhs:"val"> ;TI")Regexp.last_match(:lhs) # => "var" ;TI")Regexp.last_match('rhs') # => "val" ;TI"2Regexp.last_match('foo') # Raises IndexError.;T; 0: @fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"zRegexp.last_match -> matchdata or nil Regexp.last_match(n) -> string or nil Regexp.last_match(name) -> string or nil ;T0[ I"(*args);T@2FI"Regexp;TcRDoc::NormalClass00