ÿØÿà JFIF ÿÛ „ ( %!1!%*+...983,7(-.-
PK l]rK length-i.rinu [ U:RDoc::AnyMethod[iI"length:ETI"MatchData#length;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Returns the number of elements in the match array.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.length #=> 5
;TI"m.size #=> 5;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below000[ I"();T@FI"MatchData;TcRDoc::NormalClass0[@FI" size;TPK l]gN N post_match-i.rinu [ U:RDoc::AnyMethod[iI"post_match:ETI"MatchData#post_match;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"IReturns the portion of the original string after the current match. ;TI"8Equivalent to the special variable $'.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"7m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
;TI"%m.post_match #=> ": The Movie";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.post_match -> str
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]- values_at-i.rinu [ U:RDoc::AnyMethod[iI"values_at:ETI"MatchData#values_at;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"QUses each index to access the matching values, returning an array of ;TI"the corresponding matches.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"7m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
;TI"?m.to_a #=> ["HX1138", "H", "X", "113", "8"]
;TI"8m.values_at(0, 2, -2) #=> ["HX1138", "X", "113"]
;TI"1m.values_at(1..2, -1) #=> ["H", "X", "8"]
;TI"
;TI"@m = /(?\d+) *(?[+\-*\/]) *(?\d+)/.match("1 + 2")
;TI"7m.to_a #=> ["1 + 2", "1", "+", "2"]
;TI"1m.values_at(:a, :b, :op) #=> ["1", "2", "+"];T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"+mtch.values_at(index, ...) -> array
;T0[ I"(*args);T@FI"MatchData;TcRDoc::NormalClass00PK l]
I: : match_length-i.rinu [ U:RDoc::AnyMethod[iI"match_length:ETI"MatchData#match_length;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"QReturns the length of the captured substring corresponding to the argument. ;TI"Gn can be a string or symbol to reference a named capture.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"2m = /(.)(.)(\d+)(\d)(\w)?/.match("THX1138.")
;TI"#m.match_length(0) #=> 6
;TI"#m.match_length(4) #=> 1
;TI"%m.match_length(5) #=> nil
;TI"
;TI"0m = /(?.)(.)(?.+)/.match("hoge")
;TI"#m.match_length(:foo) #=> 1
;TI""m.match_length(:bar) #=> 2;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"%mtch.match_length(n) -> array
;T0[ I" (p1);T@FI"MatchData;TcRDoc::NormalClass00PK l]O inspect-i.rinu [ U:RDoc::AnyMethod[iI"inspect:ETI"MatchData#inspect;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"0Returns a printable version of mtch.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"$puts /.$/.match("foo").inspect
;TI"#=> #
;TI"
;TI"+puts /(.)(.)(.)/.match("foo").inspect
;TI".#=> #
;TI"
;TI"+puts /(.)(.)?(.)/.match("fo").inspect
;TI"-#=> #
;TI"
;TI">puts /(?.)(?.)(?.)/.match("hoge").inspect
;TI"3#=> #;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.inspect -> str
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]
e to_a-i.rinu [ U:RDoc::AnyMethod[iI" to_a:ETI"MatchData#to_a;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I""Returns the array of matches.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"3m.to_a #=> ["HX1138", "H", "X", "113", "8"]
;T:@format0o;
; [
I"8Because to_a is called when expanding ;TI"B*variable, there's a useful assignment ;TI"Jshortcut for extracting matched fields. This is slightly slower than ;TI"@accessing the fields directly (as an intermediate array is ;TI"generated).;T@o;; [
I":all,f1,f2,f3 = * /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"all #=> "HX1138"
;TI"f1 #=> "H"
;TI"f2 #=> "X"
;TI"f3 #=> "113";T;
0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.to_a -> anArray
;T0[ I"();T@!FI"MatchData;TcRDoc::NormalClass00PK l]
names-i.rinu [ U:RDoc::AnyMethod[iI"
names:ETI"MatchData#names;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"AReturns a list of names of captures as an array of strings. ;TI"+This is the same as mtch.regexp.names.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"7/(?.)(?.)(?.)/.match("hoge").names
;TI"#=> ["foo", "bar", "baz"]
;TI"
;TI"Gm = /(?.)(?.)?/.match("a") #=> #
;TI"4m.names #=> ["x", "y"];T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I")mtch.names -> [name1, name2, ...]
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]7 7 pre_match-i.rinu [ U:RDoc::AnyMethod[iI"pre_match:ETI"MatchData#pre_match;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JReturns the portion of the original string before the current match. ;TI"8Equivalent to the special variable $`.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.pre_match #=> "T";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.pre_match -> str
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l];np eql%3f-i.rinu [ U:RDoc::AnyMethod[iI" eql?:ETI"MatchData#eql?;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"AEquality---Two matchdata are equal if their target strings, ;TI"3patterns, and matched positions are identical.;T:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"Jmtch == mtch2 -> true or false
mtch.eql?(mtch2) -> true or false
;T0[[I"==;T@ I" (p1);T@FI"MatchData;TcRDoc::NormalClass00PK l]
7
begin-i.rinu [ U:RDoc::AnyMethod[iI"
begin:ETI"MatchData#begin;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NReturns the offset of the start of the nth element of the match ;TI"array in the string. ;TI"Gn can be a string or symbol to reference a named capture.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.begin(0) #=> 1
;TI"m.begin(2) #=> 2
;TI"
;TI"/m = /(?.)(.)(?.)/.match("hoge")
;TI"p m.begin(:foo) #=> 0
;TI"p m.begin(:bar) #=> 2;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I" mtch.begin(n) -> integer
;T0[ I" (p1);T@FI"MatchData;TcRDoc::NormalClass00PK l]%a string-i.rinu [ U:RDoc::AnyMethod[iI"string:ETI"MatchData#string;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"IReturns a frozen copy of the string passed in to match.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.string #=> "THX1138.";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.string -> str
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]l end-i.rinu [ U:RDoc::AnyMethod[iI"end:ETI"MatchData#end;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NReturns the offset of the character immediately following the end of the ;TI"<nth element of the match array in the string. ;TI"Gn can be a string or symbol to reference a named capture.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.end(0) #=> 7
;TI"m.end(2) #=> 3
;TI"
;TI"/m = /(?.)(.)(?.)/.match("hoge")
;TI"p m.end(:foo) #=> 1
;TI"p m.end(:bar) #=> 3;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.end(n) -> integer
;T0[ I" (p1);T@FI"MatchData;TcRDoc::NormalClass00PK l]U size-i.rinu [ U:RDoc::AnyMethod[iI" size:ETI"MatchData#size;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Returns the number of elements in the match array.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.length #=> 5
;TI"m.size #=> 5;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"7mtch.length -> integer
mtch.size -> integer
;T0[[I"length;T@ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]Ss s cdesc-MatchData.rinu [ U:RDoc::NormalClass[iI"MatchData:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"DMatchData encapsulates the result of matching a Regexp against ;TI"Gstring. It is returned by Regexp#match and String#match, and also ;TI"?stored in a global variable returned by Regexp.last_match.;To:RDoc::Markup::BlankLine o; ;[I"Usage:;T@o:RDoc::Markup::Verbatim;[I"@url = 'https://docs.ruby-lang.org/en/2.5.0/MatchData.html'
;TI"Am = url.match(/(\d\.?)+/) # => #
;TI"[m.string # => "https://docs.ruby-lang.org/en/2.5.0/MatchData.html"
;TI"1m.regexp # => /(\d\.?)+/
;TI"!# entire matched substring:
;TI".m[0] # => "2.5.0"
;TI"
;TI"%# Working with unnamed captures
;TI"/m = url.match(%r{([^/]+)/([^/]+)\.html$})
;TI"=m.captures # => ["2.5.0", "MatchData"]
;TI".m[1] # => "2.5.0"
;TI"=m.values_at(1, 2) # => ["2.5.0", "MatchData"]
;TI"
;TI"## Working with named captures
;TI"Bm = url.match(%r{(?[^/]+)/(?[^/]+)\.html$})
;TI"=m.captures # => ["2.5.0", "MatchData"]
;TI"Rm.named_captures # => {"version"=>"2.5.0", "module"=>"MatchData"}
;TI".m[:version] # => "2.5.0"
;TI"$m.values_at(:version, :module)
;TI"= # => ["2.5.0", "MatchData"]
;TI"*# Numerical indexes are working, too
;TI".m[1] # => "2.5.0"
;TI"=m.values_at(1, 2) # => ["2.5.0", "MatchData"]
;T:@format0S:RDoc::Markup::Heading:
leveli: textI"!Global variables equivalence;T@o; ;[I"FParts of last MatchData (returned by Regexp.last_match) are also ;TI"!aliased as global variables:;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"*$~ is Regexp.last_match;;To;;0;[o; ;[I"<$& is Regexp.last_match[ 0 ];;To;;0;[o; ;[I"5$1, $2, and so on are ;TI">Regexp.last_match[ i ] (captures by number);;To;;0;[o; ;[I"A$` is Regexp.last_match.pre_match;;To;;0;[o; ;[I"B$' is Regexp.last_match.post_match;;To;;0;[o; ;[I"P$+ is Regexp.last_match[ -1 ] (the last capture).;T@o; ;[I"ISee also "Special global variables" section in Regexp documentation.;T:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[ [;[ [;[[I"==;TI" re.c;T[I"[];T@r[I"
begin;T@r[I"
captures;T@r[I"end;T@r[I" eql?;T@r[I" hash;T@r[I"inspect;T@r[I"length;T@r[I"
match;T@r[I"match_length;T@r[I"named_captures;T@r[I"
names;T@r[I"offset;T@r[I"post_match;T@r[I"pre_match;T@r[I"regexp;T@r[I" size;T@r[I"string;T@r[I" to_a;T@r[I" to_s;T@r[I"values_at;T@r[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[I"lib/pp.rb;TI" re.c;T@YcRDoc::TopLevelPK l]H %5b%5d-i.rinu [ U:RDoc::AnyMethod[iI"[]:ETI"MatchData#[];TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HMatch Reference -- MatchData acts as an array, and may be accessed ;TI"Gusing the normal array indexing techniques. mtch[0] ;TI"His equivalent to the special variable $&, and returns ;TI"7the entire matched string. mtch[1], ;TI"Fmtch[2], and so on return the values of the matched ;TI"Bbackreferences (portions of the pattern between parentheses).;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"Dm #=> #
;TI"m[0] #=> "HX1138"
;TI"m[1, 2] #=> ["H", "X"]
;TI"&m[1..3] #=> ["H", "X", "113"]
;TI"!m[-3, 2] #=> ["X", "113"]
;TI"
;TI"'m = /(?a+)b/.match("ccaaab")
;TI"2m #=> #
;TI"m["foo"] #=> "aaa"
;TI"m[:foo] #=> "aaa";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch[i] -> str or nil
mtch[start, length] -> array
mtch[range] -> array
mtch[name] -> str or nil
;T0[ I"(p1, p2 = v2);T@!FI"MatchData;TcRDoc::NormalClass00PK l] to_s-i.rinu [ U:RDoc::AnyMethod[iI" to_s:ETI"MatchData#to_s;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"'Returns the entire matched string.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"m.to_s #=> "HX1138";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.to_s -> str
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]i named_captures-i.rinu [ U:RDoc::AnyMethod[iI"named_captures:ETI"MatchData#named_captures;TF:privateo:RDoc::Markup::Document:@parts[
o:RDoc::Markup::Paragraph; [I"(Returns a Hash using named capture.;To:RDoc::Markup::BlankLine o;
; [I"8A key of the hash is a name of the named captures. ;TI"QA value of the hash is a string of last successful capture of corresponding ;TI"group.;T@o:RDoc::Markup::Verbatim; [I"&m = /(?.)(?.)/.match("01")
;TI"3m.named_captures #=> {"a" => "0", "b" => "1"}
;TI"
;TI"&m = /(?.)(?.)?/.match("0")
;TI"3m.named_captures #=> {"a" => "0", "b" => nil}
;TI"
;TI"&m = /(?.)(?.)/.match("01")
;TI"'m.named_captures #=> {"a" => "1"}
;TI"
;TI"&m = /(?x)|(?y)/.match("x")
;TI"&m.named_captures #=> {"a" => "x"};T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"!mtch.named_captures -> hash
;T0[ I"();T@!FI"MatchData;TcRDoc::NormalClass00PK l]9
match-i.rinu [ U:RDoc::AnyMethod[iI"
match:ETI"MatchData#match;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns the captured substring corresponding to the argument. ;TI"Gn can be a string or symbol to reference a named capture.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"2m = /(.)(.)(\d+)(\d)(\w)?/.match("THX1138.")
;TI"#m.match(0) #=> "HX1138"
;TI"m.match(4) #=> "8"
;TI"m.match(5) #=> nil
;TI"
;TI"0m = /(?.)(.)(?.+)/.match("hoge")
;TI"m.match(:foo) #=> "h"
;TI"m.match(:bar) #=> "ge";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"&mtch.match(n) -> string or nil
;T0[ I" (p1);T@FI"MatchData;TcRDoc::NormalClass00PK l]N N
captures-i.rinu [ U:RDoc::AnyMethod[iI"
captures:ETI"MatchData#captures;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"PReturns the array of captures; equivalent to mtch.to_a[1..-1].;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"@f1,f2,f3,f4 = /(.)(.)(\d+)(\d)/.match("THX1138.").captures
;TI"f1 #=> "H"
;TI"f2 #=> "X"
;TI"f3 #=> "113"
;TI"f4 #=> "8";T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.captures -> array
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]W\ regexp-i.rinu [ U:RDoc::AnyMethod[iI"regexp:ETI"MatchData#regexp;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"Returns the regexp.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"m = /a.*b/.match("abc")
;TI"m.regexp #=> /a.*b/;T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.regexp -> regexp
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]rQ offset-i.rinu [ U:RDoc::AnyMethod[iI"offset:ETI"MatchData#offset;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"PReturns a two-element array containing the beginning and ending offsets of ;TI"the nth match. ;TI"Gn can be a string or symbol to reference a named capture.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"-m = /(.)(.)(\d+)(\d)/.match("THX1138.")
;TI"!m.offset(0) #=> [1, 7]
;TI"!m.offset(4) #=> [6, 7]
;TI"
;TI"/m = /(?.)(.)(?.)/.match("hoge")
;TI"!p m.offset(:foo) #=> [0, 1]
;TI" p m.offset(:bar) #=> [2, 3];T:@format0:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.offset(n) -> array
;T0[ I" (p1);T@FI"MatchData;TcRDoc::NormalClass00PK l]o %3d%3d-i.rinu [ U:RDoc::AnyMethod[iI"==:ETI"MatchData#==;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"AEquality---Two matchdata are equal if their target strings, ;TI"3patterns, and matched positions are identical.;T:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below000[ I" (p1);T@FI"MatchData;TcRDoc::NormalClass0[@FI" eql?;TPK l]6 hash-i.rinu [ U:RDoc::AnyMethod[iI" hash:ETI"MatchData#hash;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CProduce a hash based on the target string, regexp and matched ;TI"!positions of this matchdata.;To:RDoc::Markup::BlankLine o;
; [I"See also Object#hash.;T:
@fileI" re.c;T:0@omit_headings_from_table_of_contents_below0I"mtch.hash -> integer
;T0[ I"();T@FI"MatchData;TcRDoc::NormalClass00PK l]rK length-i.rinu [ PK l]gN N # post_match-i.rinu [ PK l]- values_at-i.rinu [ PK l]
I: : x match_length-i.rinu [ PK l]O inspect-i.rinu [ PK l]
e I to_a-i.rinu [ PK l]
. names-i.rinu [ PK l]7 7 # pre_match-i.rinu [ PK l];np eql%3f-i.rinu [ PK l]
7
begin-i.rinu [ PK l]%a string-i.rinu [ PK l]l end-i.rinu [ PK l]U N# size-i.rinu [ PK l]Ss s % cdesc-MatchData.rinu [ PK l]H Z2 %5b%5d-i.rinu [ PK l] 7 to_s-i.rinu [ PK l]i 9 named_captures-i.rinu [ PK l]9
= match-i.rinu [ PK l]N N
@ captures-i.rinu [ PK l]W\ pC regexp-i.rinu [ PK l]rQ ^E offset-i.rinu [ PK l]o H %3d%3d-i.rinu [ PK l]6 eJ hash-i.rinu [ PK ]L