Skip to content
instance method

MatchData#string

() -> ::String
string → string

Returns the target string if it was frozen; otherwise, returns a frozen copy of the target string:

Example
m = /(.)(.)(\d+)(\d)/.match("THX1138.")
# => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
m.string # => "THX1138."
See also #size #to_a #regexp #to_s also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0