"Guy N. Hurst" <gnhurst / hurstlinks.com> wrote in message
news:3AE105A1.688E20EA / hurstlinks.com...
> > How about
> >
> > key, val = /^(.+)=(.+)$/.match(var)[1..-1]
> > if key
> > ...
> >
> > Or
> >
> > if (key, val = /^(.+)=(.+)$/.match(var)[1..-1])[0]
> > ...
> >
>
> These will result in:
>
> NameError: undefined method `[]' for nil
>
> if there is no match...
>
>

Another try using nil.to_a = []

key, val = /^(.+)=(.+)$/.match(var).to_a[1..-1]
 if key
 ...

 Or

 if (key, val = /^(.+)=(.+)$/.match(var).to_a[1..-1])[0]
...

>
> Guy N. Hurst
>

Park Hee-Sob