Regexp issues

http://pastie.org/319919

On line 42, I get an error that there is no function '[]' for
nil:Nilclass... am I just missing something extremely obvious?

···

--
Posted via http://www.ruby-forum.com/.

Alle Thursday 20 November 2008, Tim Mcd ha scritto:

http://pastie.org/319919

On line 42, I get an error that there is no function '' for
nil:Nilclass... am I just missing something extremely obvious?

You get that error because Regexp#match returns nil if there's no match. In
this case, test is set to nil and, obviously, won't have a method.

Stefano

Tim Mcd wrote:

http://pastie.org/319919

On line 42, I get an error that there is no function '' for
nil:Nilclass... am I just missing something extremely obvious?

Your regex does not match the string, so the call to match returns nil.

HTH,
Sebastian

···

--
Jabber: sepp2k@jabber.org
ICQ: 205544826

Ah... hehe, thanks guys!

···

--
Posted via http://www.ruby-forum.com/.