I'm looking for a way to perform a regex match on a string in Ruby and have it short-circuit on the first match.
The string I'm processing is long and from what it looks like the standard way (match
method) would process the whole thing, collect each match, and return a MatchData object containing all matches.
match = string.match(/regex/)[0].to_s