Skip to content

Ruby Global $' (DollarTick)

☈king edited this page Nov 19, 2012 · 6 revisions

The $' global is the string to the right of the last successful match.

If you do this:

str = 'hello goodbye'; str[/good/]

Then this:

[ $`, $&, $' ]

Yields this: [ "hello ", "good", "bye" ]

Clone this wiki locally