@@foo += bar ^^^^^^^^^^^^
Foo::Bar &&= baz ^^^^^^^^^^^^^^^^
Foo::Bar ||= baz ^^^^^^^^^^^^^^^^
$foo += bar ^^^^^^^^^^^
@foo += bar ^^^^^^^^^^^
foo += bar ^^^^^^^^^^
@@foo += bar ^^^^^^^^^^^^
Foo::Bar &&= baz ^^^^^^^^^^^^^^^^
Foo::Bar ||= baz ^^^^^^^^^^^^^^^^
$foo += bar ^^^^^^^^^^^
@foo += bar ^^^^^^^^^^^
foo += bar ^^^^^^^^^^
Returns the regexp that produced the match:
m = /a.*b/.match("abc") # => #<MatchData "ab"> m.regexp # => /a.*b/
Returns an array of the capture names (see Named Captures):
m = /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge") # => #<MatchData "hog" foo:"h" bar:"o" baz:"g"> m.names # => ["foo", "bar", "baz"] m = /foo/.match('foo') # => #<MatchData "foo"> m.names # => [] # No named captures.
Equivalent to:
m = /(?<foo>.)(?<bar>.)(?<baz>.)/.match("hoge") m.regexp.names # => ["foo", "bar", "baz"]
Returns size of the match array:
m = /(.)(.)(\d+)(\d)/.match("THX1138.") # => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8"> m.size # => 5