Final thing: your regex won't match your string, because the /rakshit/ part
is non-optional.
On Mar 13, 2014 7:50 AM, "Matthew Kerwin" <matthew / kerwin.net.au> wrote:

> Oh, and you may need the block mode of #gsub
> On Mar 13, 2014 7:49 AM, "Matthew Kerwin" <matthew / kerwin.net.au> wrote:
>
>> \1 isn't a variable name, it's a string escape sequence. It will only
>> work inside a string. Try either map['\1'] or map[$1]
>>
>> (I just woke up so my head may still be cloudy.)
>> On Mar 13, 2014 6:14 AM, "Arup Rakshit" <lists / ruby-forum.com> wrote:
>>
>>> map = { "arup" => "1989"}
>>> puts "arup".gsub(/(arup)rakshit/, map[\1] )
>>>
>>> # ~> -:2: syntax error, unexpected $undefined, expecting ']'
>>> # ~> puts "arup".gsub(/(arup)rakshit/, map[\1] )
>>> # ~>
>>>
>>> --
>>> Posted via http://www.ruby-forum.com/.
>>>
>>