Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

MatchData#post_match

mtch.post_match → str

Returns the portion of the original string after the current match. Equivalent to the special variable $'.

Example
m = /(.)(.)(\d+)(\d)/.match("THX1138: The Movie")
m.post_match   #=> ": The Movie"
See also #offset #pre_match #names #regexp also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1