Dear Dave,

From: http://www.ruby-doc.org/core-2.1.0/Regexp.html#class-Regexp-label-Special+global+variables

Pattern matching sets some global variables :
$~ is equivalent to ::last_match;
$& contains the complete matched text;
$` contains string before match;
$' contains string after match;
$1, $2 and so on contain text matching first, second, etc capture group;
$+ contains last capture group.

Abinoam Jr.

On Tue, Feb 4, 2014 at 9:30 PM, Dave Castellano <lists / ruby-forum.com> wrote:
> Dave Castellano wrote in post #1135501:
>> Robert Klemme wrote in post #1135495:
>>
>>>
>>> if /\{\s*(\d+)\s*-\s*(\d+)\s*\}/ =~ question
>>>   n1 = Integer($1)
>>>   n2 = Integer($2)
>
>> Can you point me in the direction to look in order to understand the $1 and $2.
> Are they variables inherent to regex?
>
>> Dave
>
> --
> Posted via http://www.ruby-forum.com/.