On 5/17/07, Drew Olson <olsonas / gmail.com> wrote:
> Drew Olson wrote:
> > irb(main):009:0> mystring.scan(/CN=([^,]*),/)
> > => [["test"], ["test1"]]
>
> I have a question after studying my own solution for the ruby-wise :)
> Why does this scan return an array of arrays rather than a simple array
> of matches? I suppose the OP should really do this if he wants the
> matches:
>
> mystring.scan(/CN=([^,]*),/).flatten
>
> Why is this flatten necessary? I'm assuming I did something dopey in my
> code.
>
> -Drew
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
I think it is because of the parentheses. Try removing them and take a look.

Harry

-- 

A Look into Japanese Ruby List in English
http://www.kakueki.com/