Method: MatchData#string

Defined in:
re.c

#stringString

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

m = /(.)(.)(\d+)(\d)/.match("THX1138.")
# => #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
m.string # => "THX1138."

Returns:



2543
2544
2545
2546
2547
2548
# File 're.c', line 2543

static VALUE
match_string(VALUE match)
{
    match_check(match);
    return RMATCH(match)->str;	/* str is frozen */
}