D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
MatchData
/
Filename :
offset-i.ri
back
Copy
U:RDoc::AnyMethod[iI"offset:ETI"MatchData#offset;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns a 2-element array containing the beginning and ending ;TI"4offsets (in characters) of the specified match.;To:RDoc::Markup::BlankLine o; ; [I"6When non-negative integer argument +n+ is given, ;TI"Greturns the starting and ending offsets of the <tt>n</tt>th match:;T@o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.") ;TI":# => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8"> ;TI"m[0] # => "HX1138" ;TI"m.offset(0) # => [1, 7] ;TI"m[3] # => "113" ;TI"m.offset(3) # => [3, 6] ;TI" ;TI"*m = /(т)(е)(с)/.match('тест') ;TI"5# => #<MatchData "тес" 1:"т" 2:"е" 3:"с"> ;TI"m[0] # => "тес" ;TI"m.offset(0) # => [0, 3] ;TI"m[3] # => "с" ;TI"m.offset(3) # => [2, 3] ;T:@format0o; ; [I"5When string or symbol argument +name+ is given, ;TI"Areturns the starting and ending offsets for the named match:;T@o;; [I"/m = /(?<foo>.)(.)(?<bar>.)/.match("hoge") ;TI"-# => #<MatchData "hog" foo:"h" bar:"g"> ;TI"m[:foo] # => "h" ;TI"!m.offset('foo') # => [0, 1] ;TI"m[:bar] # => "g" ;TI"!m.offset(:bar) # => [2, 3] ;T; 0o; ; [I"CRelated: MatchData#byteoffset, MatchData#begin, MatchData#end.;T: @fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"Xoffset(n) -> [start_offset, end_offset] offset(name) -> [start_offset, end_offset] ;T0[ I" (p1);T@2FI"MatchData;TcRDoc::NormalClass00