Ruby Global $` (DollarBacktick) - rking/pry-docmore GitHub Wiki
The $` global is the string to the left of the last successful match.
If you do this:
str = 'hello goodbye'; str[/good/]
Then this:
[ $`, $&, $' ]
Yields this:
[
"hello ",
"good",
"bye"
]