method

match

v1_8_7_330 - Show latest stable - Class: Regexp
match(p1)
public

Returns a MatchData object describing the match, or nil if there was no match. This is equivalent to retrieving the value of the special variable $~ following a normal match.

/(.)(.)(.)/.match("abc")[2]   #=> "b"